Skip to content

Commit

Permalink
fix(build): force manualChunks option, fix #427
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Feb 8, 2023
1 parent 3d72efd commit bd9296e
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions packages/histoire/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,6 @@ export async function build (ctx: Context) {
join(APP_PATH, 'bundle-main.js'),
join(APP_PATH, 'bundle-sandbox.js'),
],
output: {
manualChunks (id) {
if (!id.includes('@histoire/app') && id.includes('node_modules')) {
return 'vendor'
}
},
},
plugins: [
{
name: 'histoire-build-rollup-options-override',
Expand All @@ -104,10 +97,6 @@ export async function build (ctx: Context) {
},
],
},
outDir: ctx.config.outDir,
emptyOutDir: true,
cssCodeSplit: false,
minify: false,
},
})

Expand Down Expand Up @@ -145,8 +134,25 @@ export async function build (ctx: Context) {
config (config) {
// Don't externalize
config.build.rollupOptions.external = []
// Don't build in SSR mode
config.build.ssr = false

// Force chunk strategy
config.build.rollupOptions.output = {
manualChunks (id) {
if (!id.includes('@histoire/app') && id.includes('node_modules')) {
return 'vendor'
}
},
}

// Force vite build options
Object.assign(config.build, {
outDir: ctx.config.outDir,
emptyOutDir: true,
cssCodeSplit: false,
minify: false,
// Don't build in SSR mode
ssr: false,
})
},
})

Expand Down

0 comments on commit bd9296e

Please sign in to comment.