-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.dev.js
56 lines (45 loc) · 1.58 KB
/
webpack.dev.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
// Merge multiple webpack config objects together!
const webpackMerge = require('webpack-merge');
// Plugins
const webpack = require('webpack'); // webpack built-in plugins
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const { CheckerPlugin } = require('awesome-typescript-loader'); // Needed if using --watch
var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
// Shared Webpack configuration
const commonConfig = require('./webpack.common.js');
// Helper for resolving paths
const helpers = require('./helpers.js');
// Path to localhost certificate for https.
const pathToLocalhostCertificates = './config/localhost-cert/';
const pathToLocalhostKey = pathToLocalhostCertificates + 'local.key';
const pathToLocalhostCert = pathToLocalhostCertificates + 'local.crt';
// Environment variables for use in the Angular2 App
const ENV = process.env.NODE_ENV = process.env.ENV = 'development';
module.exports = webpackMerge(commonConfig, {
output: {
filename: '[name].js',
chunkFilename: '[id].chunk.js',
path: helpers.root('.dev'),
publicPath: 'https://localhost:3030/',
},
devtool: 'inline-source-map',
plugins: [
new CheckerPlugin(),
// ENV Variable
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify(ENV)
}
}),
// NOTE(rex): Starts a server and opens a UI analyzing the contents of your app bundle.
// new BundleAnalyzerPlugin({})
],
devServer: {
historyApiFallback: true,
stats: 'minimal',
https: {
'key': pathToLocalhostKey,
'cert': pathToLocalhostCert
}
}
});