File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ import type {
14
14
} from './types' ;
15
15
16
16
export async function workerThread ( sys : System ) {
17
+ // Special case: we allow importing qwik again in the same process, it's ok because we just needed the serializer
18
+ // TODO: remove this once we have vite environment API and no longer need the serializer separately
19
+ delete ( globalThis as any ) . __qwik ;
17
20
const ssgOpts = sys . getOptions ( ) ;
18
21
const pendingPromises = new Set < Promise < any > > ( ) ;
19
22
@@ -42,6 +45,9 @@ export async function workerThread(sys: System) {
42
45
}
43
46
44
47
export async function createSingleThreadWorker ( sys : System ) {
48
+ // Special case: we allow importing qwik again in the same process, it's ok because we just needed the serializer
49
+ // TODO: remove this once we have vite environment API and no longer need the serializer separately
50
+ delete ( globalThis as any ) . __qwik ;
45
51
const ssgOpts = sys . getOptions ( ) ;
46
52
const pendingPromises = new Set < Promise < any > > ( ) ;
47
53
Original file line number Diff line number Diff line change
1
+ //////////////////////////////////////////////////////////////////////////////////////////
2
+ // Protect against duplicate imports
3
+ //////////////////////////////////////////////////////////////////////////////////////////
4
+ import { version } from './version' ;
5
+ if ( ( globalThis as any ) . __qwik ) {
6
+ throw new Error (
7
+ `Qwik version ${ ( globalThis as any ) . __qwik } already imported while importing ${ version } . Verify external vs bundled imports etc.`
8
+ ) ;
9
+ }
10
+ ( globalThis as any ) . __qwik = version ;
11
+
1
12
//////////////////////////////////////////////////////////////////////////////////////////
2
13
// Developer Core API
3
14
//////////////////////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments