From 72def6b3043ae9ac5944bb57ba98ea87b22e78f7 Mon Sep 17 00:00:00 2001 From: dmt Date: Sat, 24 Aug 2024 14:25:46 -0700 Subject: [PATCH] trying to get the build working --- package.json | 2 +- vite.config.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 8f5640f3..7d30268a 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "prepare": "npm run build", "build-docs": "node node_modules/documentation/bin/documentation.js build src/Histogram.ts src/View3d.ts src/Volume.ts src/VolumeMaker.ts src/VolumeLoader.ts -f html -o docs --shallow", "build": "npm run transpileES && npm run build-types", - "vbuild": "vite build", + "vbuild": "vite build ./", "build-types": "tsc -p tsconfig.types.json", "build-demo": "webpack --config webpack.demo.js", "clean": "rimraf es/", diff --git a/vite.config.ts b/vite.config.ts index a5a5d0c0..e3fc6636 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -10,11 +10,14 @@ export default defineConfig({ test: { exclude: [...configDefaults.exclude, "es/test/*"], }, + worker: { format: "es" }, build: { - lib: { entry: resolve(__dirname, "src/index.ts"), formats: ["es"] }, + lib: { entry: resolve(__dirname, "src/index.ts"), formats: ["es"], name: "@aics/volume-viewer" }, + sourcemap: true, rollupOptions: { + // treat all ts files as entry points so that they are translated preserving the directory structure input: Object.fromEntries( - globSync("src/**/*.js").map((file) => [ + globSync("src/**/*.ts", { ignore: ["src/test/**/*.ts", "node_modules"] }).map((file) => [ // This remove `src/` as well as the file extension from each // file, so e.g. src/nested/foo.js becomes nested/foo path.relative("src", file.slice(0, file.length - path.extname(file).length)), @@ -25,7 +28,9 @@ export default defineConfig({ ), output: { format: "es", - dir: "dist", + dir: "es", + // treat all ts files as entry points so that they are translated preserving the directory structure + entryFileNames: "[name].js", }, }, },