-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
67 lines (66 loc) · 1.68 KB
/
webpack.dev.js
File metadata and controls
67 lines (66 loc) · 1.68 KB
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
58
59
60
61
62
63
64
65
66
67
const path = require('path')
const HtmlPlugin = require('html-webpack-plugin')
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin')
const ESLintWebpackPlugin = require('eslint-webpack-plugin')
module.exports = {
entry: path.resolve(__dirname, 'src/index.js'),
mode: 'development',
devtool: 'cheap-module-source-map',
watch: true,
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 9000,
historyApiFallback: true,
stats: 'minimal',
hot: true
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'static/js/[name].chunk.js'
},
optimization: {
splitChunks: {
chunks: 'all',
name: false
}
},
module: {
rules: [
{
oneOf: [
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
include: path.resolve(__dirname, 'src'),
loader: require.resolve('babel-loader'),
exclude: /node_modules/,
options: {
cacheDirectory: true,
cacheCompression: false,
presets: ['@babel/preset-react', '@babel/preset-env']
}
},
{
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
loader: require.resolve('file-loader'),
options: {
name: 'static/media/[name].[hash:8].[ext]'
}
}
]
}
]
},
plugins: [
new HtmlPlugin({
inject: true,
template: 'sample/index.html'
}),
new CaseSensitivePathsPlugin(),
new ESLintWebpackPlugin({
context: path.resolve(__dirname, 'src'),
extensions: ['js', 'ts', 'jsx', 'tsx'],
fix: true
})
]
}