forked from jhipster/jhipster-sample-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.test.js
87 lines (85 loc) · 2.67 KB
/
webpack.test.js
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
const webpack = require('webpack');
const path = require('path');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const utils = require('./utils.js');
module.exports = (WATCH) => ({
resolve: {
extensions: ['.ts', '.js'],
alias: {
app: utils.root('src/main/webapp/app/')
}
},
module: {
rules: [
{
test: /\.ts$/,
enforce: 'pre',
loader: 'tslint-loader',
exclude: /node_modules/
},
{
test: /\.ts$/,
use: [
{ loader: 'cache-loader' },
{ loader: 'ts-loader' },
{
loader: 'angular2-template-loader',
options: {
keepUrl: true
}
}
],
exclude: /node_modules/
},
{
test: /\.(html|css)$/,
loader: 'raw-loader',
exclude: /\.async\.(html|css)$/
},
{
test: /\.async\.(html|css)$/,
loaders: ['file?name=[name].[hash].[ext]', 'extract']
},
{
test: /\.scss$/,
loaders: ['to-string-loader', 'css-loader', 'sass-loader']
},
{
test: /src[/|\\]main[/|\\]webapp[/|\\].+\.ts$/,
enforce: 'post',
exclude: /node_modules/,
loader: 'sourcemap-istanbul-instrumenter-loader?force-sourcemap=true'
},
// Ignore warnings about System.import in Angular
{
test: /[\/\\]@angular[\/\\].+\.js$/,
parser: { system: true }
},
]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
SERVER_API_URL: `''`
}
}),
new webpack.SourceMapDevToolPlugin({
filename: null, // if no value is provided the sourcemap is inlined
test: /\.(ts|js)($|\?)/i // process .js and .ts files only
}),
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
utils.root('./src') // location of your src
),
new LoaderOptionsPlugin({
options: {
tslint: {
emitErrors: !WATCH,
failOnHint: false
}
}
})
],
mode: 'development'
});