-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
48 lines (47 loc) · 1.31 KB
/
webpack.dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const path = require( 'path' );
const webpack = require( 'webpack' );
const HTML = require( 'html-webpack-plugin') ;
const Clean = require( 'clean-webpack-plugin' );
const ExtractText = require( 'extract-text-webpack-plugin' );
module.exports = {
context: path.resolve( __dirname, './src' ),
entry: path.resolve( __dirname, './dev/App.js' ),
output: {
path: path.resolve( __dirname, './dev-build' ),
filename: 'bundle.[hash].js',
library: 'flex-react',
libraryTarget: 'umd',
},
devtool: 'eval',
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node-modules/,
loader: 'babel-loader',
},
{
test: /\.scss$/,
use: ExtractText.extract({
fallback: 'style-loader',
use: ['css-loader', 'postcss-loader', 'sass-loader'],
}),
},
],
},
resolve: {
extensions: ['.js', '.jsx'],
},
devServer: {
contentBase: path.resolve( __dirname, './dev-build' ),
port: process.env.PORT || 3000,
historyApiFallback: true,
},
plugins: [
new Clean(['dev-build'], { root: path.resolve( __dirname, './' )}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new HTML({ template: path.resolve( __dirname, './dev/index.html' ) }),
new ExtractText( '[name].css' ),
],
};