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