()
| 54 | } |
| 55 | |
| 56 | function plugins() { |
| 57 | return { |
| 58 | ignoreEsprima: () => new webpack.IgnorePlugin({ resourceRegExp: /^esprima$/ }), |
| 59 | friendlyErrors: () => new FriendlyErrorsWebpackPlugin(), |
| 60 | buffer: () => |
| 61 | new webpack.ProvidePlugin({ |
| 62 | Buffer: ['buffer', 'Buffer'], |
| 63 | process: 'process/browser', |
| 64 | }), |
| 65 | nodePolyfill: () => new NodePolyfillPlugin(), |
| 66 | stripNodeProtocol: () => |
| 67 | new webpack.NormalModuleReplacementPlugin(/^node:/, resource => { |
| 68 | const moduleName = resource.request.replace(/^node:/, ''); |
| 69 | // Handle node:url specially to provide fileURLToPath polyfill |
| 70 | if (moduleName === 'url') { |
| 71 | resource.request = path.resolve(__dirname, 'shims/fileURLToPath.js'); |
| 72 | } else { |
| 73 | resource.request = moduleName; |
| 74 | } |
| 75 | }), |
| 76 | }; |
| 77 | } |
| 78 | |
| 79 | function stats() { |
| 80 | if (isProduction) { |
no test coverage detected