aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/config/webpack.dev.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/config/webpack.dev.js')
-rw-r--r--client/config/webpack.dev.js159
1 files changed, 91 insertions, 68 deletions
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js
index 0b6c00cbd..964ea56a5 100644
--- a/client/config/webpack.dev.js
+++ b/client/config/webpack.dev.js
@@ -7,6 +7,7 @@ const commonConfig = require('./webpack.common.js') // the settings that are com
7 */ 7 */
8const DefinePlugin = require('webpack/lib/DefinePlugin') 8const DefinePlugin = require('webpack/lib/DefinePlugin')
9const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') 9const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin')
10const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
10 11
11/** 12/**
12 * Webpack Constants 13 * Webpack Constants
@@ -30,66 +31,53 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
30module.exports = function (env) { 31module.exports = function (env) {
31 return webpackMerge(commonConfig({env: ENV}), { 32 return webpackMerge(commonConfig({env: ENV}), {
32 /** 33 /**
33 * Merged metadata from webpack.common.js for index.html 34 * Developer tool to enhance debugging
34 * 35 *
35 * See: (custom attribute) 36 * See: http://webpack.github.io/docs/configuration.html#devtool
36 */ 37 * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps
37 metadata: METADATA, 38 */
38
39 /**
40 * Switch loaders to debug mode.
41 *
42 * See: http://webpack.github.io/docs/configuration.html#debug
43 */
44 debug: true,
45
46 /**
47 * Developer tool to enhance debugging
48 *
49 * See: http://webpack.github.io/docs/configuration.html#devtool
50 * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps
51 */
52 devtool: 'cheap-module-source-map', 39 devtool: 'cheap-module-source-map',
53 40
54 /** 41 /**
55 * Options affecting the output of the compilation. 42 * Options affecting the output of the compilation.
56 * 43 *
57 * See: http://webpack.github.io/docs/configuration.html#output 44 * See: http://webpack.github.io/docs/configuration.html#output
58 */ 45 */
59 output: { 46 output: {
60 /** 47 /**
61 * The output directory as absolute path (required). 48 * The output directory as absolute path (required).
62 * 49 *
63 * See: http://webpack.github.io/docs/configuration.html#output-path 50 * See: http://webpack.github.io/docs/configuration.html#output-path
64 */ 51 */
65 path: helpers.root('dist'), 52 path: helpers.root('dist'),
66 53
67 /** 54 /**
68 * Specifies the name of each output file on disk. 55 * Specifies the name of each output file on disk.
69 * IMPORTANT: You must not specify an absolute path here! 56 * IMPORTANT: You must not specify an absolute path here!
70 * 57 *
71 * See: http://webpack.github.io/docs/configuration.html#output-filename 58 * See: http://webpack.github.io/docs/configuration.html#output-filename
72 */ 59 */
73 filename: '[name].bundle.js', 60 filename: '[name].bundle.js',
74 61
75 /** 62 /**
76 * The filename of the SourceMaps for the JavaScript files. 63 * The filename of the SourceMaps for the JavaScript files.
77 * They are inside the output.path directory. 64 * They are inside the output.path directory.
78 * 65 *
79 * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename 66 * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename
80 */ 67 */
81 sourceMapFilename: '[name].map', 68 sourceMapFilename: '[name].map',
82 69
83 /** The filename of non-entry chunks as relative path 70 /** The filename of non-entry chunks as relative path
84 * inside the output.path directory. 71 * inside the output.path directory.
85 * 72 *
86 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename 73 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename
87 */ 74 */
88 chunkFilename: '[id].chunk.js', 75 chunkFilename: '[id].chunk.js',
89 76
90 library: 'ac_[name]', 77 library: 'ac_[name]',
91 libraryTarget: 'var' 78 libraryTarget: 'var',
92 79
80 publicPath: '/client/'
93 }, 81 },
94 82
95 externals: { 83 externals: {
@@ -99,14 +87,14 @@ module.exports = function (env) {
99 plugins: [ 87 plugins: [
100 88
101 /** 89 /**
102 * Plugin: DefinePlugin 90 * Plugin: DefinePlugin
103 * Description: Define free variables. 91 * Description: Define free variables.
104 * Useful for having development builds with debug logging or adding global constants. 92 * Useful for having development builds with debug logging or adding global constants.
105 * 93 *
106 * Environment helpers 94 * Environment helpers
107 * 95 *
108 * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin 96 * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
109 */ 97 */
110 // NOTE: when adding more properties, make sure you include them in custom-typings.d.ts 98 // NOTE: when adding more properties, make sure you include them in custom-typings.d.ts
111 new DefinePlugin({ 99 new DefinePlugin({
112 'ENV': JSON.stringify(METADATA.ENV), 100 'ENV': JSON.stringify(METADATA.ENV),
@@ -118,21 +106,56 @@ module.exports = function (env) {
118 } 106 }
119 }), 107 }),
120 108
121 new NamedModulesPlugin() 109 /**
110 * Plugin: NamedModulesPlugin (experimental)
111 * Description: Uses file names as module name.
112 *
113 * See: https://github.com/webpack/webpack/commit/a04ffb928365b19feb75087c63f13cadfc08e1eb
114 */
115 new NamedModulesPlugin(),
116
117 /**
118 * Plugin LoaderOptionsPlugin (experimental)
119 *
120 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
121 */
122 new LoaderOptionsPlugin({
123 debug: true,
124 options: {
125
126 /**
127 * Static analysis linter for TypeScript advanced options configuration
128 * Description: An extensible linter for the TypeScript language.
129 *
130 * See: https://github.com/wbuchwalter/tslint-loader
131 */
132 tslint: {
133 emitErrors: false,
134 failOnHint: false,
135 resourcePath: 'src'
136 },
137
138 // FIXME: Remove
139 // https://github.com/bholloway/resolve-url-loader/issues/36
140 // https://github.com/jtangelder/sass-loader/issues/289
141 context: __dirname,
142 output: {
143 path: helpers.root('dist')
144 }
145
146 }
147 })
148
122 ], 149 ],
123 150
124 /** 151 /**
125 * Static analysis linter for TypeScript advanced options configuration 152 * Webpack Development Server configuration
126 * Description: An extensible linter for the TypeScript language. 153 * Description: The webpack-dev-server is a little node.js Express server.
127 * 154 * The server emits information about the compilation state to the client,
128 * See: https://github.com/wbuchwalter/tslint-loader 155 * which reacts to those events.
129 */ 156 *
130 tslint: { 157 * See: https://webpack.github.io/docs/webpack-dev-server.html
131 emitErrors: false, 158 */
132 failOnHint: false,
133 resourcePath: 'src'
134 },
135
136 devServer: { 159 devServer: {
137 port: METADATA.port, 160 port: METADATA.port,
138 host: METADATA.host, 161 host: METADATA.host,
@@ -145,13 +168,13 @@ module.exports = function (env) {
145 }, 168 },
146 169
147 /* 170 /*
148 * Include polyfills or mocks for various node stuff 171 * Include polyfills or mocks for various node stuff
149 * Description: Node configuration 172 * Description: Node configuration
150 * 173 *
151 * See: https://webpack.github.io/docs/configuration.html#node 174 * See: https://webpack.github.io/docs/configuration.html#node
152 */ 175 */
153 node: { 176 node: {
154 global: 'window', 177 global: true,
155 crypto: 'empty', 178 crypto: 'empty',
156 process: true, 179 process: true,
157 module: false, 180 module: false,