Skip to content

Commit

Permalink
Add dev build commands for vue3 package
Browse files Browse the repository at this point in the history
  • Loading branch information
dk981234 committed Nov 22, 2023
1 parent 7a8deb4 commit c1de09a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 31 deletions.
2 changes: 2 additions & 0 deletions packages/survey-vue3-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"preview": "vite preview",
"build-only": "vite build",
"watch": "vite build --watch",
"watch:dev": "vite build --watch --mode development",
"build": "vite build && npm run build:types",
"build:dev": "vite build --mode development",
"build:types": "vue-tsc --project tsconfig.types.json --emitDeclarationOnly",
"type-check": "vue-tsc --project tsconfig.types.json --noEmit",
"test": "vitest --no-threads tests/test.spec.ts",
Expand Down
65 changes: 34 additions & 31 deletions packages/survey-vue3-ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,42 @@ json.version = packageJson.version;
const libraryName = "survey-vue3-ui";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
export default defineConfig(({ mode }) => {
return {
plugins: [vue()],

build: {
// Output compiled files to /dist.
outDir: "../../build/survey-vue3-ui",
lib: {
// Set the entry point (file that contains our components exported).
entry: resolve(__dirname, "src/index.ts"),
// Name of the library.
name: "SurveyVue",
// We are building for CJS and ESM, use a function to rename automatically files.
// Example: my-component-library.esm.js
fileName: (format) => `${libraryName}.${format}.js`,
},
rollupOptions: {
// Vue is provided by the parent project, don't compile Vue source-code inside our library.
external: ["vue", "survey-core"],
build: {
sourcemap: mode == "development",
// Output compiled files to /dist.
outDir: "../../build/survey-vue3-ui",
lib: {
// Set the entry point (file that contains our components exported).
entry: resolve(__dirname, "src/index.ts"),
// Name of the library.
name: "SurveyVue",
// We are building for CJS and ESM, use a function to rename automatically files.
// Example: my-component-library.esm.js
fileName: (format) => `${libraryName}.${format}.js`,
},
rollupOptions: {
// Vue is provided by the parent project, don't compile Vue source-code inside our library.
external: ["vue", "survey-core"],

plugins: [
generatePackageJson({
inputFolder: "publish",
outputFolder: "../../build/survey-vue3-ui",
baseContents: json,
}),
],
output: { globals: { vue: "Vue", "survey-core": "Survey" } },
plugins: [
generatePackageJson({
inputFolder: "publish",
outputFolder: "../../build/survey-vue3-ui",
baseContents: json,
}),
],
output: { globals: { vue: "Vue", "survey-core": "Survey" } },
},
},
},
resolve: {
preserveSymlinks: true,
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
resolve: {
preserveSymlinks: true,
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
},
};
});

0 comments on commit c1de09a

Please sign in to comment.