forked from edgebr/angular-confirmation-popover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
56 lines (55 loc) · 1.3 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
import * as webpack from 'webpack';
import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
const IS_PROD = process.argv.indexOf('-p') > -1;
export default {
devtool: IS_PROD ? 'source-map' : 'eval',
entry: __dirname + '/demo/entry.ts',
output: {
filename: 'demo.js',
path: IS_PROD ? __dirname + '/demo' : __dirname
},
module: {
rules: [{
test: /\.ts$/,
loader: 'tslint-loader',
exclude: /node_modules/,
enforce: 'pre',
options: {
emitErrors: IS_PROD,
failOnHint: IS_PROD
}
}, {
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
transpileOnly: true
}
}]
},
resolve: {
extensions: ['.ts', '.js']
},
devServer: {
port: 8000,
inline: true,
hot: true,
historyApiFallback: true,
contentBase: 'demo'
},
plugins: [
...(IS_PROD ? [] : [new webpack.HotModuleReplacementPlugin()]),
new webpack.DefinePlugin({
ENV: JSON.stringify(IS_PROD ? 'production' : 'development')
}),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/,
__dirname + '/src'
),
new ForkTsCheckerWebpackPlugin({
watch: ['./src', './demo'],
formatter: 'codeframe',
async: !IS_PROD
})
]
};