Project

General

Profile

1 50428 argiro.kok
// 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
  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
  },
27
  plugins: [
28
    new webpack.ContextReplacementPlugin(
29
      // fixes WARNING Critical dependency: the request of a dependency is an expression
30
      /(.+)?angular(\\|\/)core(.+)?/,
31
      path.join(__dirname, 'src'), // location of your src
32
      {} // a map of your routes
33
    ),
34
    new webpack.ContextReplacementPlugin(
35
      // fixes WARNING Critical dependency: the request of a dependency is an expression
36
      /(.+)?express(\\|\/)(.+)?/,
37
      path.join(__dirname, 'src'),
38
      {}
39
    )
40
  ]
41
}