* Webpack Plugins
*/
const DefinePlugin = require('webpack/lib/DefinePlugin')
+const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin')
/**
* Webpack Constants
*/
const ENV = process.env.ENV = process.env.NODE_ENV = 'development'
+const HOST = process.env.HOST || 'localhost'
+const PORT = process.env.PORT || 3000
const HMR = helpers.hasProcessFlag('hot')
-const METADATA = webpackMerge(commonConfig.metadata, {
- host: 'localhost',
- port: 3000,
+const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
+ host: HOST,
+ port: PORT,
ENV: ENV,
HMR: HMR
})
*
* See: http://webpack.github.io/docs/configuration.html#cli
*/
-module.exports = webpackMerge(commonConfig, {
+module.exports = webpackMerge(commonConfig({env: ENV}), {
/**
* Merged metadata from webpack.common.js for index.html
*
*
* See: http://webpack.github.io/docs/configuration.html#output-chunkfilename
*/
- chunkFilename: '[id].chunk.js'
+ chunkFilename: '[id].chunk.js',
+ library: 'ac_[name]',
+ libraryTarget: 'var'
+
+ },
+
+ externals: {
+ webtorrent: 'WebTorrent'
},
plugins: [
'NODE_ENV': JSON.stringify(METADATA.ENV),
'HMR': METADATA.HMR
}
- })
+ }),
+
+ new NamedModulesPlugin()
],
/**
resourcePath: 'src'
},
- /**
- * Webpack Development Server configuration
- * Description: The webpack-dev-server is a little node.js Express server.
- * The server emits information about the compilation state to the client,
- * which reacts to those events.
- *
- * See: https://webpack.github.io/docs/webpack-dev-server.html
- */
devServer: {
port: METADATA.port,
host: METADATA.host,