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');
17 // '/scripts/polyfills',
20 // '/scripts/sw-register',
21 // '/scripts/scripts',
26 module.exports = function(env) {
28 const webpackDevConfig = {
29 devtool: "source-map",
30 devServer: ServerConfig(env),
33 { test: /\.(eot|svg)$/, loader: "file-loader?name=scripts/fonts/[name].[hash:20].[ext]" },
34 { test: /\.(jpg|png|gif|otf|ttf|woff|woff2|cur|ani)$/, loader: "url-loader?name=scripts/images/[name].[hash:20].[ext]&limit=10000" }
38 path: path.join(process.cwd(), "dist"),
39 filename: "[name].bundle.js",
40 chunkFilename: "[id].chunk.js"
44 // Replace /sdc1 inside index.html with '' (because /sdc1 is used only in production).
45 new CopyWebpackPlugin([
47 from: './src/index.html', transform: function(content, path) {
48 content = (content+'').replace(/\/sdc1/g,'');
53 new webpack.DefinePlugin({
54 __DEBUG__: JSON.stringify(true),
55 __ENV__: JSON.stringify('dev'),
56 __HMR__: JSON.stringify('HMR')
58 new webpack.HotModuleReplacementPlugin()
63 return merge(webpackDevConfig, webpackCommonConfig(params));