forked from joinedapp/nexus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
57 lines (55 loc) · 1.37 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const WriteFilePlugin = require('write-file-webpack-plugin');
const webpack = require('webpack');
module.exports = {
devServer: {
compress: true,
contentBase: path.resolve(__dirname, 'dist'),
historyApiFallback: true,
hot: true,
overlay: true,
port: 3000,
watchContentBase: true,
},
devtool: 'cheap-module-eval-source-map',
mode: 'development',
module: {
rules: [
{
exclude: [path.resolve(__dirname, 'node_modules/')],
test: /\.js$/,
use: ['babel-loader'],
},
],
},
output: {
chunkFilename: '[chunkhash].js',
filename: '[hash].js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
sourceMapFilename: '../../sourcemap/[file].map',
},
optimization: {
splitChunks: {
cacheGroups: {
vendors: {
chunks: 'all',
name: 'vendor',
priority: -20,
test: /node_modules/,
},
},
},
},
plugins: [
new CopyWebpackPlugin([{ context: './assets/', from: './**/*', to: './' }]),
new HtmlWebpackPlugin({
title: 'challenge',
template: path.resolve(__dirname, 'index.html'),
}),
new webpack.HotModuleReplacementPlugin(),
new WriteFilePlugin(),
],
};