-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.common.js
37 lines (36 loc) · 1.36 KB
/
webpack.config.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
/**
* This file contains environment-independent configuration.
* The config defined here will be merged with one of the environment-specific configs.
*/
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const htmlWebpackPlugin = new HtmlWebpackPlugin({
/* Used to include Webpack in the HTML file without a <script> tag. */
template: './client/index.html',
filename: 'index.html',
inject: 'body',
chunksSortMode: 'dependency'
});
module.exports = {
entry: './client/index.jsx',
output: {
path: path.resolve('distribution'),
filename: 'index_bundle.js'
},
module: {
rules: [
{test: /\.js$/, use: 'babel-loader', exclude: /node_modules/},
{test: /\.jsx$/, use: 'babel-loader', exclude: /node_modules/},
{test: /\.(jpe?g|gif)$/i, exclude: /node_modules/, use: {loader: 'file-loader', options: {name: 'images/[name].[hash:6].[ext]'}}},
{test: /favicon\.ico$/, use: {loader: 'file-loader', options: {name: '[name].[ext]'}}},
{test: /\.(woff|woff2|eot|ttf|svg|png)$/, exclude: /node_modules/, use: {loader: 'url-loader', options: {limit: 100000, name: 'images/[name].[hash:6].[ext]'}}}
]
},
resolve: {
extensions: ['.js', '.jsx']
},
plugins: [
htmlWebpackPlugin
],
devtool: "source-map"
};