Skip to content

Commit

Permalink
fix: split up bundle for tree-shaking (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored Oct 18, 2023
1 parent 9d3b9e0 commit af2d287
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export default defineConfig({
},
rollupOptions: {
external: (id: string) => !id.startsWith('.') && !path.isAbsolute(id) && !inline.includes(id),
output: {
preserveModules: true,
preserveModulesRoot: 'src',
},
},
},
plugins: [
Expand All @@ -24,7 +28,7 @@ export default defineConfig({
for (const id in bundle) {
const asset = bundle[id]
if ('code' in asset) {
asset.code = asset.code.replace(/three\/(addons|examples)[^'"`]+/g, 'three-stdlib')
asset.code = asset.code.replace(/three\/(addons|examples)[^'"`]*/g, 'three-stdlib')
}
}
},
Expand Down

0 comments on commit af2d287

Please sign in to comment.