Skip to content

Commit

Permalink
fix: wrong output path in vite.config to emit
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Dec 29, 2024
1 parent 1ba2627 commit f57a404
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/typst.ts/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -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'),
Expand All @@ -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
},
},
Expand Down

0 comments on commit f57a404

Please sign in to comment.