File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -544,7 +544,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
544
544
)
545
545
546
546
// pre-transform known direct imports
547
- if ( staticImportedUrls . size ) {
547
+ if ( config . server . preTransformRequests && staticImportedUrls . size ) {
548
548
staticImportedUrls . forEach ( ( url ) => {
549
549
server . transformRequest ( unwrapId ( removeImportQuery ( url ) ) , { ssr } )
550
550
} )
Original file line number Diff line number Diff line change @@ -114,6 +114,13 @@ export interface ServerOptions extends CommonServerOptions {
114
114
* @default true
115
115
*/
116
116
bindShortcuts ?: boolean
117
+ /**
118
+ * Pre-transform known direct imports
119
+ *
120
+ * @experimental this option is experimental and might be changed in the future
121
+ * @default true
122
+ */
123
+ preTransformRequests ?: boolean
117
124
}
118
125
119
126
export interface ResolvedServerOptions extends ServerOptions {
@@ -702,7 +709,10 @@ export function resolveServerOptions(
702
709
root : string ,
703
710
raw ?: ServerOptions
704
711
) : ResolvedServerOptions {
705
- const server = raw || { }
712
+ const server : ResolvedServerOptions = {
713
+ preTransformRequests : true ,
714
+ ...( raw as ResolvedServerOptions )
715
+ }
706
716
let allowDirs = server . fs ?. allow
707
717
708
718
if ( ! allowDirs ) {
@@ -723,7 +733,7 @@ export function resolveServerOptions(
723
733
allow : allowDirs
724
734
}
725
735
server . static = resolveStaticOptions ( server )
726
- return server as ResolvedServerOptions
736
+ return server
727
737
}
728
738
729
739
async function restartServer ( server : ViteDevServer ) {
You can’t perform that action at this time.
0 commit comments