Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong output path in vite.config to emit #623

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading