3 const path = require('path');
4 const merge = require('webpack-merge');
5 const webpack = require('webpack');
6 const ServerConfig = require('./webpack.server');
7 const webpackCommonConfig = require('./webpack.common');
8 const {BaseHrefWebpackPlugin} = require('@angular/cli/plugins/webpack');
9 const CopyWebpackPlugin = require('copy-webpack-plugin');
11 // Print server configuration
12 //process.stdout.write('webpack.server: ' + JSON.stringify(ServerConfig) + '\n');
13 //process.stdout.write('webpack.common: ' + JSON.stringify(webpackCommonConfig) + '\n');
14 var currentTime = new Date().getTime();
19 // '/scripts/polyfills',
22 // '/scripts/sw-register',
23 // '/scripts/scripts',
28 module.exports = function (env) {
30 const webpackDevConfig = {
31 devtool: "source-map",
32 devServer: ServerConfig(env),
35 {test: /\.(eot|svg)$/, loader: "file-loader?name=scripts/fonts/[name].[hash:20].[ext]"},
37 test: /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/,
38 loader: "url-loader?name=scripts/images/[name].[hash:20].[ext]&limit=10000"
43 path: path.join(process.cwd(), "dist"),
44 filename: "[name]." + currentTime + ".bundle.js",
45 chunkFilename: "[id].chunk.js"
50 // Replace /sdc1 inside index.html with '' (because /sdc1 is used only in production).
51 new CopyWebpackPlugin([
53 from: './src/index.html', transform: function (content, path) {
54 content = (content + '').replace(/\/sdc1/g, '');
55 content = (content + '').replace(/\.bundle/g, '.' + currentTime + '.bundle');
60 new webpack.DefinePlugin({
61 __DEBUG__: JSON.stringify(true),
62 __ENV__: JSON.stringify('dev'),
63 __HMR__: JSON.stringify('HMR')
65 new webpack.HotModuleReplacementPlugin()
70 return merge(webpackDevConfig, webpackCommonConfig(params));