blob: 4f03b7c87c0c2e4cee841074366bc9a408d20c24 [file] [log] [blame]
Michael Landoed64b5e2017-06-09 03:19:04 +03001'use strict';
2
3const path = require('path');
4const merge = require('webpack-merge');
5const webpack = require('webpack');
6const ServerConfig = require('./webpack.server');
7const webpackCommonConfig = require('./webpack.common');
8const { BaseHrefWebpackPlugin} = require('@angular/cli/plugins/webpack');
9const CopyWebpackPlugin = require('copy-webpack-plugin');
10
11// Print server configuration
12//process.stdout.write('webpack.server: ' + JSON.stringify(ServerConfig) + '\n');
13//process.stdout.write('webpack.common: ' + JSON.stringify(webpackCommonConfig) + '\n');
14const params = {
15 // entryPoints: [
16 // '/scripts/inline',
17 // '/scripts/polyfills',
18 // '/scripts/vendor',
19 // '/scripts/main',
20 // '/scripts/sw-register',
21 // '/scripts/scripts',
22 // '/scripts/styles'
23 // ]
24};
25
26module.exports = function(env) {
27
28 const webpackDevConfig = {
29 devtool: "source-map",
30 devServer: ServerConfig(env),
31 module: {
32 rules: [
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" }
35 ]
36 },
37 output: {
38 path: path.join(process.cwd(), "dist"),
39 filename: "[name].bundle.js",
40 chunkFilename: "[id].chunk.js"
41 //publicPath: "/"
42 },
43 plugins: [
44 // Replace /sdc1 inside index.html with '' (because /sdc1 is used only in production).
45 new CopyWebpackPlugin([
46 {
47 from: './src/index.html', transform: function(content, path) {
48 content = (content+'').replace(/\/sdc1/g,'');
49 return content;
50 }
51 }
52 ]),
53 new webpack.DefinePlugin({
54 __DEBUG__: JSON.stringify(true),
55 __ENV__: JSON.stringify('dev'),
56 __HMR__: JSON.stringify('HMR')
57 }),
58 new webpack.HotModuleReplacementPlugin()
59 ]
60
61 };
62
63 return merge(webpackDevConfig, webpackCommonConfig(params));
64}