-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
43 lines (40 loc) · 1.36 KB
/
webpack.common.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
const path = require('path');
const WebpackNotifierPlugin = require("webpack-notifier");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const WriteFilePlugin = require('write-file-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const customConfigs = require('./webpack.custom'); // Using your own configs
module.exports = {
entry: customConfigs.entryPoints,// which file to begin with
output: {
path: path.resolve(__dirname, customConfigs.distDir), // what folder to put bundle in
filename: '[name].[hash].js', // what name to use for bundle
publicPath: '/' // Using for React-Router
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
include: [
path.resolve(__dirname, "src")
],
use: ['babel-loader']
}
]
},
resolve: {
extensions: ['*', '.js', '.jsx']
},
plugins: [
new WebpackNotifierPlugin({ alwaysNotify: true }),
new HtmlWebpackPlugin({ template: customConfigs.htmlTemplate }),
new CleanWebpackPlugin(),
new WriteFilePlugin({
test: /\.(png|jpg|gif)$/i
}),
new CopyWebpackPlugin([
{from:'src/images',to:'images'}
])
]
};