-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
34 lines (30 loc) · 1.02 KB
/
webpack.config.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
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var extractPlugin = new ExtractTextPlugin({
filename: 'main.css'
});
var htmlWebpackPlugin = new HtmlWebpackPlugin({
template: 'src/client/index.html'
});
var cleanWebpackPlugin = new CleanWebpackPlugin([
'dist'
]);
module.exports = {
entry: './src/client/js/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
//publicPath: '/dist'
},
module: {
rules: [
{ test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.scss$/, use: extractPlugin.extract({ use: ['css-loader', 'sass-loader'] }) },
{ test: /\.html$/, use: ['html-loader'] },
{ test: /\.(jpg|png)$/, use: [{ loader : 'file-loader', options: {name: '[name].[ext]', outputPath: 'img/', publicPath: 'img/'} }] }
]
},
plugins: [extractPlugin, htmlWebpackPlugin]
}