|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -// This is the webpack configuration for browesr Karma tests. |
| 17 | +const webpackNodePolyfills = require('../../../webpack.node-polyfills.js'); |
| 18 | + |
| 19 | +// This is the webpack configuration for browser Karma tests. |
18 | 20 | module.exports = { |
19 | 21 | mode: 'development', |
20 | | - output: {filename: 'bundle.js'}, |
21 | | - resolve: {extensions: ['.ts', '.js']}, |
| 22 | + target: 'web', |
| 23 | + output: { filename: 'bundle.js' }, |
| 24 | + resolve: { extensions: ['.ts', '.js'] }, |
22 | 25 | devtool: 'inline-source-map', |
23 | 26 | module: { |
24 | 27 | rules: [ |
25 | | - {test: /\.ts$/, use: 'ts-loader'}, |
26 | | - { |
27 | | - parser: { |
28 | | - // This setting configures Node polyfills for the browser that will be |
29 | | - // added to the webpack bundle for Karma tests. |
30 | | - node: { |
31 | | - // Enable the assert library polyfill because that is used in tests |
32 | | - assert: true, |
33 | | - // The assert polyfill from github.com/browserify/commonjs-assert |
34 | | - // also requires the `global` polyfill. |
35 | | - global: true, |
36 | | - |
37 | | - // Turn off all other Node.js API polyfills for the browser tests to |
38 | | - // make sure that we are not attempting to use Node-specific APIs in |
39 | | - // the browser code. Instead, we will write browser specific |
40 | | - // implementations of platform functionality we need under the |
41 | | - // `./src/platform/browser` folder. This allows for writing browser |
42 | | - // optimized implementations of the specific needed functionality |
43 | | - // rather than bringing in (sometimes large) polyfills for the |
44 | | - // corresponding Node APIs. |
45 | | - Buffer: false, |
46 | | - __dirname: false, |
47 | | - __filename: false, |
48 | | - buffer: false, |
49 | | - child_process: false, |
50 | | - cluster: false, |
51 | | - console: false, |
52 | | - constants: false, |
53 | | - crypto: false, |
54 | | - dgram: false, |
55 | | - dns: false, |
56 | | - domain: false, |
57 | | - events: false, |
58 | | - fs: false, |
59 | | - http: false, |
60 | | - https: false, |
61 | | - module: false, |
62 | | - net: false, |
63 | | - os: false, |
64 | | - path: false, |
65 | | - process: false, |
66 | | - punycode: false, |
67 | | - querystring: false, |
68 | | - readline: false, |
69 | | - repl: false, |
70 | | - setImmediate: false, |
71 | | - stream: false, |
72 | | - string_decoder: false, |
73 | | - sys: false, |
74 | | - timers: false, |
75 | | - tls: false, |
76 | | - tty: false, |
77 | | - url: false, |
78 | | - util: false, |
79 | | - vm: false, |
80 | | - zlib: false, |
81 | | - }, |
82 | | - }, |
83 | | - }, |
84 | | - ], |
85 | | - }, |
| 28 | + { test: /\.ts$/, use: 'ts-loader' }, |
| 29 | + // This setting configures Node polyfills for the browser that will be |
| 30 | + // added to the webpack bundle for Karma tests. |
| 31 | + { parser: { node: webpackNodePolyfills } } |
| 32 | + ] |
| 33 | + } |
86 | 34 | }; |
0 commit comments