File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
packages/qwik/src/optimizer/src/plugins Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -136,15 +136,20 @@ export function createQwikPlugin(optimizerOptions: OptimizerOptions = {}) {
136
136
if ( ! internalOptimizer ) {
137
137
internalOptimizer = await createOptimizer ( optimizerOptions ) ;
138
138
lazyNormalizePath = makeNormalizePath ( internalOptimizer . sys ) ;
139
- try {
140
- // only try once, don't spam the console
141
- if ( maybeFs === undefined ) {
142
- maybeFs = await internalOptimizer . sys . dynamicImport ( 'node:fs' ) ;
139
+ if (
140
+ internalOptimizer . sys . env !== 'browsermain' &&
141
+ internalOptimizer . sys . env !== 'webworker'
142
+ ) {
143
+ try {
144
+ // only try once, don't spam the console
145
+ if ( maybeFs === undefined ) {
146
+ maybeFs = await internalOptimizer . sys . dynamicImport ( 'node:fs' ) ;
147
+ }
148
+ } catch {
149
+ // eslint-disable-next-line no-console
150
+ console . log ( 'node:fs not available, disabling automatic manifest reading' ) ;
151
+ maybeFs = null ;
143
152
}
144
- } catch {
145
- // eslint-disable-next-line no-console
146
- console . log ( 'node:fs not available, disabling automatic manifest reading' ) ;
147
- maybeFs = null ;
148
153
}
149
154
}
150
155
} ;
Original file line number Diff line number Diff line change 1
1
import type { OptimizerSystem } from '../types' ;
2
2
3
3
export async function findDepPkgJsonPath ( sys : OptimizerSystem , dep : string , parent : string ) {
4
+ if ( sys . env === 'browsermain' || sys . env === 'webworker' ) {
5
+ return undefined ;
6
+ }
4
7
const fs : typeof import ( 'fs' ) = await sys . dynamicImport ( 'node:fs' ) ;
5
8
let root = parent ;
6
9
while ( root ) {
You can’t perform that action at this time.
0 commit comments