forked from ollelauribostrom/rebus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·41 lines (40 loc) · 990 Bytes
/
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
35
36
37
38
39
40
41
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
module.exports = publicPath => ({
entry: {
main: './src/js/app.js'
},
output: {
filename: '[name].bundle.js',
chunkFilename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist/'),
publicPath: publicPath || '/'
},
devtool: 'source-map',
resolve: { extensions: ['.js', '.json'] },
module: {
rules: [
// Process JS with Babel.
{
test: /\.(js)$/,
include: path.resolve(__dirname, 'src/'),
loader: require.resolve('babel-loader')
},
// HTML
{ test: /\.html$/, use: ['html-loader'] },
// CSS
{ test: /\.css$/, use: ['style-loader', 'css-loader'] }
]
},
plugins: [
new HtmlWebPackPlugin({
template: './src/index.html',
favicon: './src/favicon.ico',
filename: 'index.html'
})
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
port: 3000
}
});