File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
packages/vite-plugin-svelte/src/plugins Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -70,20 +70,23 @@ export function configure(api, inlineOptions) {
70
70
//@ts -ignore rolldownOptions only exists in rolldown-vite
71
71
extraViteConfig . build . rolldownOptions = extraViteConfig . build . rollupOptions || { } ;
72
72
delete extraViteConfig . build . rollupOptions ;
73
-
74
- // set inlineConst
75
- // TODO is `inlineConst: "safe"` safe to use with esm-env (we have to ensure it is always inlined)
76
- if (
73
+ // read user config inlineConst value
74
+ const inlineConst =
77
75
//@ts -ignore optimization only exists in rolldown-vite
78
- config . build ?. rollupOptions ?. optimization ?. inlineConst == null &&
79
- //@ts -ignore rolldownOptions only exists in rolldown-vite
80
- config . build ?. rolldownOptions ?. optimization ?. inlineConst == null
81
- ) {
76
+ config . build ?. rolldownOptions ?. optimization ?. inlineConst ??
77
+ //@ts -ignore optimization only exists in rolldown-vite
78
+ config . build ?. rollupOptions ?. optimization ?. inlineConst ;
79
+
80
+ if ( inlineConst == null ) {
82
81
// set inlineConst build optimization for esm-env
83
82
//@ts -ignore rolldownOptions only exists in rolldown-vite
84
83
extraViteConfig . build . rolldownOptions . optimization ??= { } ;
85
84
//@ts -ignore rolldownOptions only exists in rolldown-vite
86
85
extraViteConfig . build . rolldownOptions . optimization . inlineConst = true ;
86
+ } else if ( inlineConst === false ) {
87
+ log . warn (
88
+ 'Your rolldown config contains `optimization.inlineConst: false`. This can lead to increased bundle size and leaked server code in client build.'
89
+ ) ;
87
90
}
88
91
}
89
92
}
You can’t perform that action at this time.
0 commit comments