|
| 1 | +// Work around for https://github.com/angular/angular-cli/issues/7200 |
| 2 | + |
| 3 | +const path = require('path'); |
| 4 | +const webpack = require('webpack'); |
| 5 | + |
| 6 | +module.exports = { |
| 7 | + mode: 'none', |
| 8 | + entry: { |
| 9 | + // This is our Hapi server for Dynamic universal |
| 10 | + server: './<%= stripTsExtension(serverFileName) %>.ts' |
| 11 | + }, |
| 12 | + target: 'node', |
| 13 | + resolve: { extensions: ['.ts', '.js'] }, |
| 14 | + optimization: { |
| 15 | + minimize: false |
| 16 | + }, |
| 17 | + output: { |
| 18 | + // Puts the output at the root of the dist folder |
| 19 | + path: path.join(__dirname, 'dist'), |
| 20 | + filename: '[name].js' |
| 21 | + }, |
| 22 | + module: { |
| 23 | + rules: [ |
| 24 | + { test: /\.ts$/, loader: 'ts-loader' }, |
| 25 | + { |
| 26 | + // Mark files inside `@angular/core` as using SystemJS style dynamic imports. |
| 27 | + // Removing this will cause deprecation warnings to appear. |
| 28 | + test: /(\\|\/)@angular(\\|\/)core(\\|\/).+\.js$/, |
| 29 | + parser: { system: true }, |
| 30 | + }, |
| 31 | + ] |
| 32 | + }, |
| 33 | + plugins: [ |
| 34 | + new webpack.ContextReplacementPlugin( |
| 35 | + // fixes WARNING Critical dependency: the request of a dependency is an expression |
| 36 | + /(.+)?angular(\\|\/)core(.+)?/, |
| 37 | + path.join(__dirname, 'src'), // location of your src |
| 38 | + {} // a map of your routes |
| 39 | + ), |
| 40 | + new webpack.ContextReplacementPlugin( |
| 41 | + // fixes WARNING Critical dependency: the request of a dependency is an expression |
| 42 | + /(.+)?hapi(\\|\/)(.+)?/, |
| 43 | + path.join(__dirname, 'src'), |
| 44 | + {} |
| 45 | + ) |
| 46 | + ] |
| 47 | +}; |
0 commit comments