1 const helpers = require('./helpers')
2 const webpackMerge = require('webpack-merge') // used to merge webpack configs
3 const commonConfig = require('./webpack.common.js') // the settings that are common to prod and dev
8 const DefinePlugin = require('webpack/lib/DefinePlugin')
9 const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin')
14 const ENV = process.env.ENV = process.env.NODE_ENV = 'development'
15 const HOST = process.env.HOST || 'localhost'
16 const PORT = process.env.PORT || 3000
17 const HMR = helpers.hasProcessFlag('hot')
18 const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
26 * Webpack configuration
28 * See: http://webpack.github.io/docs/configuration.html#cli
30 module.exports = webpackMerge(commonConfig({env: ENV}), {
32 * Merged metadata from webpack.common.js for index.html
34 * See: (custom attribute)
39 * Switch loaders to debug mode.
41 * See: http://webpack.github.io/docs/configuration.html#debug
46 * Developer tool to enhance debugging
48 * See: http://webpack.github.io/docs/configuration.html#devtool
49 * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps
51 devtool: 'cheap-module-source-map',
54 * Options affecting the output of the compilation.
56 * See: http://webpack.github.io/docs/configuration.html#output
60 * The output directory as absolute path (required).
62 * See: http://webpack.github.io/docs/configuration.html#output-path
64 path: helpers.root('dist'),
67 * Specifies the name of each output file on disk.
68 * IMPORTANT: You must not specify an absolute path here!
70 * See: http://webpack.github.io/docs/configuration.html#output-filename
72 filename: '[name].bundle.js',
75 * The filename of the SourceMaps for the JavaScript files.
76 * They are inside the output.path directory.
78 * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename
80 sourceMapFilename: '[name].map',
82 /** The filename of non-entry chunks as relative path
83 * inside the output.path directory.
85 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename
87 chunkFilename: '[id].chunk.js',
95 webtorrent: 'WebTorrent'
101 * Plugin: DefinePlugin
102 * Description: Define free variables.
103 * Useful for having development builds with debug logging or adding global constants.
105 * Environment helpers
107 * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
109 // NOTE: when adding more properties, make sure you include them in custom-typings.d.ts
111 'ENV': JSON.stringify(METADATA.ENV),
114 'ENV': JSON.stringify(METADATA.ENV),
115 'NODE_ENV': JSON.stringify(METADATA.ENV),
120 new NamedModulesPlugin()
124 * Static analysis linter for TypeScript advanced options configuration
125 * Description: An extensible linter for the TypeScript language.
127 * See: https://github.com/wbuchwalter/tslint-loader
138 historyApiFallback: true,
140 aggregateTimeout: 300,
143 outputPath: helpers.root('dist')
147 * Include polyfills or mocks for various node stuff
148 * Description: Node configuration
150 * See: https://webpack.github.io/docs/configuration.html#node
157 clearImmediate: false,