Project

General

Profile

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 Express server for Dynamic universal
10
    server: './server.ts',
11
    // This is an example of Static prerendering (generative)
12
    prerender: './prerender.ts'
13
  },
14
  target: 'node',
15
  resolve: { extensions: ['.ts', '.js'] },
16
  // Make sure we include all node_modules etc
17
  externals: [/(node_modules|main\..*\.js)/,],
18
  optimization: {
19
    minimize: false
20
  },
21
  output: {
22
    // Puts the output at the root of the dist folder
23
    path: path.join(__dirname, 'dist'),
24
    filename: '[name].js'
25
  },
26
  module: {
27
    rules: [
28
      { test: /\.ts$/, loader: 'ts-loader' }
29
      ,{
30
        // Mark files inside `@angular/core` as using SystemJS style dynamic imports.
31
        // Removing this will cause deprecation warnings to appear.
32
        test: /(\\|\/)@angular(\\|\/)core(\\|\/).+\.js$/,
33
        parser: { system: true },
34
      },
35
    ]
36
  },
37
  plugins: [
38
    new webpack.ContextReplacementPlugin(
39
      // fixes WARNING Critical dependency: the request of a dependency is an expression
40
      /(.+)?angular(\\|\/)core(.+)?/,
41
      path.join(__dirname, 'src'), // location of your src
42
      {} // a map of your routes
43
    ),
44
    new webpack.ContextReplacementPlugin(
45
      // fixes WARNING Critical dependency: the request of a dependency is an expression
46
      /(.+)?express(\\|\/)(.+)?/,
47
      path.join(__dirname, 'src'),
48
      {}
49
    )
50
  ]
51
}
(8-8/8)