Skip to content

Commit

Permalink
[#63734] bundle library js to single MystEditor.js file
Browse files Browse the repository at this point in the history
  • Loading branch information
Trzcin committed Aug 8, 2024
1 parent 2b2ae7c commit 686966f
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,19 @@ export default defineConfig({
lib: {
entry: [
resolve(__dirname, 'src/MystEditor.js'),
resolve(__dirname, 'src/styles/MystEditor.css'),
resolve(__dirname, 'src/index.html')
],
formats: ['es'],
},
rollupOptions: {
output: {
assetFileNames: 'MystEditor.css',
chunkFileNames: (chunk) => {
if (chunk.name === "MystEditor") {
// This will be the main MystEditor library file
return "MystEditor.js";
manualChunks: (module) => {
if (module.includes("index.html")) {
return "index";
} else {
return "MystEditor";
}
return "[name]-[hash].js";
},
entryFileNames: (chunk) => {
if (chunk.name === "MystEditor") {
// This will apply to files generated for the index.html MyST demo
return "MystEditorDemo.js";
}
return "[name].js";
}
}
}
Expand Down

0 comments on commit 686966f

Please sign in to comment.