forked from mattlewis92/angular-resizable-element
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
61 lines (59 loc) · 1.46 KB
/
webpack.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
import * as webpack from 'webpack';
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const isDevServer = process.argv.find(v => v.includes('webpack-dev-server'));
export default {
mode: isDevServer ? 'development' : 'production',
entry: __dirname + '/demo/entry.ts',
output: {
filename: 'demo.js',
path: isDevServer ? __dirname : __dirname + '/demo'
},
module: {
rules: [
{
test: /\.ts$/,
loader: 'tslint-loader?emitErrors=false&failOnHint=false',
exclude: /node_modules/,
enforce: 'pre'
},
{
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
transpileOnly: isDevServer
}
},
{
test: /node_modules\/@angular\/core\/.+\/core\.js$/,
parser: {
system: true // disable `System.import() is deprecated and will be removed soon. Use import() instead.` warning
}
}
]
},
resolve: {
extensions: ['.ts', '.js']
},
devServer: {
port: 8000,
inline: true,
hot: true,
historyApiFallback: true,
contentBase: 'demo'
},
plugins: [
...(isDevServer
? [
new webpack.HotModuleReplacementPlugin(),
new ForkTsCheckerWebpackPlugin({
watch: ['./src', './demo']
})
]
: []),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)fesm5/,
__dirname + '/src'
)
]
};