]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/config/webpack.dev.js
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')
10 const LoaderOptionsPlugin
= require('webpack/lib/LoaderOptionsPlugin')
15 const ENV
= process
.env
.ENV
= process
.env
.NODE_ENV
= 'development'
16 const HOST
= process
.env
.HOST
|| 'localhost'
17 const PORT
= process
.env
.PORT
|| 3000
18 const HMR
= helpers
.hasProcessFlag('hot')
19 const METADATA
= webpackMerge(commonConfig({env: ENV
}).metadata
, {
27 * Webpack configuration
29 * See: http://webpack.github.io/docs/configuration.html#cli
31 module
.exports = function (env
) {
32 return webpackMerge(commonConfig({env: ENV
}), {
34 * Developer tool to enhance debugging
36 * See: http://webpack.github.io/docs/configuration.html#devtool
37 * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps
39 devtool: 'cheap-module-source-map',
42 * Options affecting the output of the compilation.
44 * See: http://webpack.github.io/docs/configuration.html#output
48 * The output directory as absolute path (required).
50 * See: http://webpack.github.io/docs/configuration.html#output-path
52 path: helpers
.root('dist'),
55 * Specifies the name of each output file on disk.
56 * IMPORTANT: You must not specify an absolute path here!
58 * See: http://webpack.github.io/docs/configuration.html#output-filename
60 filename: '[name].bundle.js',
63 * The filename of the SourceMaps for the JavaScript files.
64 * They are inside the output.path directory.
66 * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename
68 sourceMapFilename: '[name].map',
70 /** The filename of non-entry chunks as relative path
71 * inside the output.path directory.
73 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename
75 chunkFilename: '[id].chunk.js',
80 publicPath: '/client/'
84 webtorrent: 'WebTorrent'
90 * Plugin: DefinePlugin
91 * Description: Define free variables.
92 * Useful for having development builds with debug logging or adding global constants.
96 * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
98 // NOTE: when adding more properties, make sure you include them in custom-typings.d.ts
100 'ENV': JSON
.stringify(METADATA
.ENV
),
103 'ENV': JSON
.stringify(METADATA
.ENV
),
104 'NODE_ENV': JSON
.stringify(METADATA
.ENV
),
110 * Plugin: NamedModulesPlugin (experimental)
111 * Description: Uses file names as module name.
113 * See: https://github.com/webpack/webpack/commit/a04ffb928365b19feb75087c63f13cadfc08e1eb
115 new NamedModulesPlugin(),
118 * Plugin LoaderOptionsPlugin (experimental)
120 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
122 new LoaderOptionsPlugin({
127 * Static analysis linter for TypeScript advanced options configuration
128 * Description: An extensible linter for the TypeScript language.
130 * See: https://github.com/wbuchwalter/tslint-loader
139 // https://github.com/bholloway/resolve-url-loader/issues/36
140 // https://github.com/jtangelder/sass-loader/issues/289
143 path: helpers
.root('dist')
152 * Webpack Development Server configuration
153 * Description: The webpack-dev-server is a little node.js Express server.
154 * The server emits information about the compilation state to the client,
155 * which reacts to those events.
157 * See: https://webpack.github.io/docs/webpack-dev-server.html
162 historyApiFallback: true,
164 aggregateTimeout: 300,
167 outputPath: helpers
.root('dist')
171 * Include polyfills or mocks for various node stuff
172 * Description: Node configuration
174 * See: https://webpack.github.io/docs/configuration.html#node
181 clearImmediate: false,