-
Notifications
You must be signed in to change notification settings - Fork 32
/
webpack4.config.ts
116 lines (115 loc) · 2.97 KB
/
webpack4.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import * as webpack from 'webpack';
import * as path from 'path';
module.exports = {
mode: 'development',
devtool: 'inline-source-map',
resolve: {
extensions: ['.ts', '.js'],
modules: [path.join(__dirname, '../../src'), 'node_modules'],
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader',
},
{
test: /\.ts$/,
// loaders: ['ts-loader', 'angular2-template-loader'],
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
{
loader: 'angular2-template-loader',
},
],
exclude: [/node_modules/, /test.ts/, /polyfills.ts/],
},
{
test: /\.(js|ts)$/,
loader: 'istanbul-instrumenter-loader',
options: { esModules: true },
enforce: 'post',
include: path.join(__dirname, '../..', 'src'),
exclude: [
/\.(e2e|spec)\.ts$/,
/node_modules/,
/(ngfactory|ngstyle)\.js/,
],
},
{
// Mark files inside `@angular/core` as using SystemJS style dynamic imports.
// Removing this will cause deprecation warnings to appear.
test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/,
parser: { system: true },
},
{
test: /\.css$/,
loader: 'raw-loader',
},
{
test: /(\.scss|\.sass)$/,
use: ['raw-loader', 'sass-loader'],
},
{
test: /\.html$/,
loader: 'raw-loader',
exclude: [path.join(__dirname, '../../src/index.html')],
},
{
test: /\.(jpe?g|png|gif)$/i,
loader: 'file-loader?name=assets/images/[name].[ext]',
},
{
test: /\.(mp4|webm|ogg)$/i,
loader: 'file-loader?name=assets/videos/[name].[ext]',
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader:
'file-loader?limit=10000&mimetype=image/svg+xml&name=assets/svgs/[name].[ext]',
},
{
test: /\.eot(\?v=\d+.\d+.\d+)?$/,
loader:
'file-loader?prefix=font/&limit=5000&name=assets/fonts/[name].[ext]',
},
{
test: /\.(woff|woff2)$/,
loader:
'file-loader?prefix=font/&limit=5000&name=assets/fonts/[name].[ext]',
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader:
'file-loader?limit=10000&mimetype=application/octet-stream&name=assets/fonts/[name].[ext]',
},
],
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'test'),
}),
new webpack.ContextReplacementPlugin(
/\@angular(\\|\/)core(\\|\/)f?esm5/,
path.join(__dirname, './src'),
),
],
performance: {
hints: false,
},
node: {
global: true,
crypto: 'empty',
process: false,
module: false,
clearImmediate: false,
setImmediate: false,
fs: 'empty',
},
};