File tree 2 files changed +35
-0
lines changed
packages/angular_devkit/build_angular/src
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -146,4 +146,31 @@ describe('Server Builder', () => {
146
146
147
147
await run . stop ( ) ;
148
148
} ) ;
149
+
150
+ it ( 'should not try to resolve web-worker' , async ( ) => {
151
+ host . writeMultipleFiles ( {
152
+ 'src/app/app.worker.ts' : `
153
+ /// <reference lib="webworker" />
154
+
155
+ const foo: string = 'hello world';
156
+ addEventListener('message', ({ data }) => {
157
+ postMessage(foo);
158
+ });
159
+ ` ,
160
+ 'src/main.server.ts' : `
161
+ if (typeof Worker !== 'undefined') {
162
+ const worker = new Worker(new URL('./app/app.worker', import.meta.url), { type: 'module' });
163
+ worker.onmessage = ({ data }) => {
164
+ console.log('page got message:', data);
165
+ };
166
+ worker.postMessage('hello');
167
+ }
168
+ ` ,
169
+ } ) ;
170
+
171
+ const run = await architect . scheduleTarget ( target ) ;
172
+ const output = ( await run . result ) as ServerBuilderOutput ;
173
+ expect ( output . success ) . toBe ( true ) ;
174
+ await run . stop ( ) ;
175
+ } ) ;
149
176
} ) ;
Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ export function getServerConfig(wco: WebpackConfigOptions): Configuration {
39
39
output : {
40
40
libraryTarget : 'commonjs' ,
41
41
} ,
42
+ module : {
43
+ parser : {
44
+ javascript : {
45
+ worker : false ,
46
+ url : false ,
47
+ } ,
48
+ } ,
49
+ } ,
42
50
plugins : [
43
51
// Fixes Critical dependency: the request of a dependency is an expression
44
52
new ContextReplacementPlugin ( / @ ? h a p i ( \\ | \/ ) / ) ,
You can’t perform that action at this time.
0 commit comments