webpack.server.config.js (1248B)
1 const path = require('path'); 2 const webpack = require('webpack'); 3 4 module.exports = { 5 entry: { server: './server.ts' }, 6 resolve: { extensions: ['.js', '.ts'] }, 7 target: 'node', 8 mode: 'none', 9 // this makes sure we include node_modules and other 3rd party libraries 10 externals: [/node_modules/], 11 devtool: 'source-map', 12 output: { 13 path: path.join(__dirname, 'dist'), 14 filename: '[name].js' 15 }, 16 module: { 17 rules: [ 18 { test: /\.ts$/, loader: 'ts-loader' }, 19 { 20 // Mark files inside `@angular/core` as using SystemJS style dynamic imports. 21 // Removing this will cause deprecation warnings to appear. 22 test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/, 23 parser: { system: true }, 24 }, 25 ] 26 }, 27 plugins: [ 28 // Temporary Fix for issue: https://github.com/angular/angular/issues/11580 29 // for "WARNING Critical dependency: the request of a dependency is an expression" 30 new webpack.ContextReplacementPlugin( 31 /(.+)?angular(\\|\/)core(.+)?/, 32 path.join(__dirname, 'src'), // location of your src 33 {} // a map of your routes 34 ), 35 new webpack.ContextReplacementPlugin( 36 /(.+)?express(\\|\/)(.+)?/, 37 path.join(__dirname, 'src'), 38 {} 39 ) 40 ] 41 };