aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/config
diff options
context:
space:
mode:
Diffstat (limited to 'client/config')
-rw-r--r--client/config/webpack.dev.js217
1 files changed, 109 insertions, 108 deletions
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js
index 5e4c708d6..0b6c00cbd 100644
--- a/client/config/webpack.dev.js
+++ b/client/config/webpack.dev.js
@@ -27,135 +27,136 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
27 * 27 *
28 * See: http://webpack.github.io/docs/configuration.html#cli 28 * See: http://webpack.github.io/docs/configuration.html#cli
29 */ 29 */
30module.exports = webpackMerge(commonConfig({env: ENV}), { 30module.exports = function (env) {
31 /** 31 return webpackMerge(commonConfig({env: ENV}), {
32 * Merged metadata from webpack.common.js for index.html
33 *
34 * See: (custom attribute)
35 */
36 metadata: METADATA,
37
38 /**
39 * Switch loaders to debug mode.
40 *
41 * See: http://webpack.github.io/docs/configuration.html#debug
42 */
43 debug: true,
44
45 /**
46 * Developer tool to enhance debugging
47 *
48 * See: http://webpack.github.io/docs/configuration.html#devtool
49 * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps
50 */
51 devtool: 'cheap-module-source-map',
52
53 /**
54 * Options affecting the output of the compilation.
55 *
56 * See: http://webpack.github.io/docs/configuration.html#output
57 */
58 output: {
59 /** 32 /**
60 * The output directory as absolute path (required). 33 * Merged metadata from webpack.common.js for index.html
61 * 34 *
62 * See: http://webpack.github.io/docs/configuration.html#output-path 35 * See: (custom attribute)
63 */ 36 */
64 path: helpers.root('dist'), 37 metadata: METADATA,
65 38
66 /** 39 /**
67 * Specifies the name of each output file on disk. 40 * Switch loaders to debug mode.
68 * IMPORTANT: You must not specify an absolute path here!
69 * 41 *
70 * See: http://webpack.github.io/docs/configuration.html#output-filename 42 * See: http://webpack.github.io/docs/configuration.html#debug
71 */ 43 */
72 filename: '[name].bundle.js', 44 debug: true,
73 45
74 /** 46 /**
75 * The filename of the SourceMaps for the JavaScript files. 47 * Developer tool to enhance debugging
76 * They are inside the output.path directory.
77 * 48 *
78 * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename 49 * See: http://webpack.github.io/docs/configuration.html#devtool
50 * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps
79 */ 51 */
80 sourceMapFilename: '[name].map', 52 devtool: 'cheap-module-source-map',
81 53
82 /** The filename of non-entry chunks as relative path 54 /**
83 * inside the output.path directory. 55 * Options affecting the output of the compilation.
84 * 56 *
85 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename 57 * See: http://webpack.github.io/docs/configuration.html#output
86 */ 58 */
87 chunkFilename: '[id].chunk.js', 59 output: {
60 /**
61 * The output directory as absolute path (required).
62 *
63 * See: http://webpack.github.io/docs/configuration.html#output-path
64 */
65 path: helpers.root('dist'),
66
67 /**
68 * Specifies the name of each output file on disk.
69 * IMPORTANT: You must not specify an absolute path here!
70 *
71 * See: http://webpack.github.io/docs/configuration.html#output-filename
72 */
73 filename: '[name].bundle.js',
74
75 /**
76 * The filename of the SourceMaps for the JavaScript files.
77 * They are inside the output.path directory.
78 *
79 * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename
80 */
81 sourceMapFilename: '[name].map',
82
83 /** The filename of non-entry chunks as relative path
84 * inside the output.path directory.
85 *
86 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename
87 */
88 chunkFilename: '[id].chunk.js',
89
90 library: 'ac_[name]',
91 libraryTarget: 'var'
88 92
89 library: 'ac_[name]', 93 },
90 libraryTarget: 'var'
91 94
92 }, 95 externals: {
96 webtorrent: 'WebTorrent'
97 },
93 98
94 externals: { 99 plugins: [
95 webtorrent: 'WebTorrent' 100
96 }, 101 /**
102 * Plugin: DefinePlugin
103 * Description: Define free variables.
104 * Useful for having development builds with debug logging or adding global constants.
105 *
106 * Environment helpers
107 *
108 * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
109 */
110 // NOTE: when adding more properties, make sure you include them in custom-typings.d.ts
111 new DefinePlugin({
112 'ENV': JSON.stringify(METADATA.ENV),
113 'HMR': METADATA.HMR,
114 'process.env': {
115 'ENV': JSON.stringify(METADATA.ENV),
116 'NODE_ENV': JSON.stringify(METADATA.ENV),
117 'HMR': METADATA.HMR
118 }
119 }),
97 120
98 plugins: [ 121 new NamedModulesPlugin()
122 ],
99 123
100 /** 124 /**
101 * Plugin: DefinePlugin 125 * Static analysis linter for TypeScript advanced options configuration
102 * Description: Define free variables. 126 * Description: An extensible linter for the TypeScript language.
103 * Useful for having development builds with debug logging or adding global constants.
104 *
105 * Environment helpers
106 * 127 *
107 * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin 128 * See: https://github.com/wbuchwalter/tslint-loader
108 */ 129 */
109 // NOTE: when adding more properties, make sure you include them in custom-typings.d.ts 130 tslint: {
110 new DefinePlugin({ 131 emitErrors: false,
111 'ENV': JSON.stringify(METADATA.ENV), 132 failOnHint: false,
112 'HMR': METADATA.HMR, 133 resourcePath: 'src'
113 'process.env': {
114 'ENV': JSON.stringify(METADATA.ENV),
115 'NODE_ENV': JSON.stringify(METADATA.ENV),
116 'HMR': METADATA.HMR
117 }
118 }),
119
120 new NamedModulesPlugin()
121 ],
122
123 /**
124 * Static analysis linter for TypeScript advanced options configuration
125 * Description: An extensible linter for the TypeScript language.
126 *
127 * See: https://github.com/wbuchwalter/tslint-loader
128 */
129 tslint: {
130 emitErrors: false,
131 failOnHint: false,
132 resourcePath: 'src'
133 },
134
135 devServer: {
136 port: METADATA.port,
137 host: METADATA.host,
138 historyApiFallback: true,
139 watchOptions: {
140 aggregateTimeout: 300,
141 poll: 1000
142 }, 134 },
143 outputPath: helpers.root('dist')
144 },
145
146 /*
147 * Include polyfills or mocks for various node stuff
148 * Description: Node configuration
149 *
150 * See: https://webpack.github.io/docs/configuration.html#node
151 */
152 node: {
153 global: 'window',
154 crypto: 'empty',
155 process: true,
156 module: false,
157 clearImmediate: false,
158 setImmediate: false
159 }
160 135
161}) 136 devServer: {
137 port: METADATA.port,
138 host: METADATA.host,
139 historyApiFallback: true,
140 watchOptions: {
141 aggregateTimeout: 300,
142 poll: 1000
143 },
144 outputPath: helpers.root('dist')
145 },
146
147 /*
148 * Include polyfills or mocks for various node stuff
149 * Description: Node configuration
150 *
151 * See: https://webpack.github.io/docs/configuration.html#node
152 */
153 node: {
154 global: 'window',
155 crypto: 'empty',
156 process: true,
157 module: false,
158 clearImmediate: false,
159 setImmediate: false
160 }
161 })
162}