diff --git a/packages/survey-vue3-ui/package.json b/packages/survey-vue3-ui/package.json index 73cee9d41b..dd5f7468ef 100644 --- a/packages/survey-vue3-ui/package.json +++ b/packages/survey-vue3-ui/package.json @@ -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", diff --git a/packages/survey-vue3-ui/vite.config.ts b/packages/survey-vue3-ui/vite.config.ts index 06f169176b..d09aee5dd8 100644 --- a/packages/survey-vue3-ui/vite.config.ts +++ b/packages/survey-vue3-ui/vite.config.ts @@ -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)), + }, }, - }, + }; });