diff --git a/packages/typst.ts/vite.config.mjs b/packages/typst.ts/vite.config.mjs index 787ce3d4..1508cac4 100644 --- a/packages/typst.ts/vite.config.mjs +++ b/packages/typst.ts/vite.config.mjs @@ -1,16 +1,18 @@ // build.js import { defineConfig } from 'vite'; -import banner from 'vite-plugin-banner' +import banner from 'vite-plugin-banner'; const bannerContent = `/* THIS IS A GENERATED/BUNDLED FILE BY VITE if you want to view the source, please visit the github repository https://github.com/Myriad-Dreamin/typst.ts/blob/main/packages/typst.ts */`; -const component = process.argv.find((arg) => arg.startsWith('--component=')); +const component = process.argv.find(arg => arg.startsWith('--component=')); const componentName = component ? component.split('=')[1] : 'main'; -const entry = (name, path) => ({[name]: { name, entry: {[name]: `./src/${path}.mts`} }}); +const entry = (name, path) => ({ + [name]: { name, _path: path, entry: { [name]: `./src/${path}.mts` } }, +}); const libs = { ...entry('main', 'main'), @@ -34,13 +36,13 @@ export default defineConfig({ lib: { ...lib, formats: ['es', 'cjs'], - fileName: (f, id) => `${f === 'es' ? 'esm' : 'cjs'}/${id}.bundle.js`, + fileName: (f, id) => `${f === 'es' ? 'esm' : 'cjs'}/${libs[id]._path}.bundle.js`, }, emptyOutDir: false, rollupOptions: { output: { inlineDynamicImports: true, - } + }, // other options }, },