forked from codedthemes/mantis-free-react-admin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.eslint.config.js
80 lines (78 loc) · 2.33 KB
/
webpack.eslint.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
const path = require('path');
// eslint-disable-next-line import/no-extraneous-dependencies
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
// eslint-disable-next-line import/no-extraneous-dependencies
const webpack = require('webpack');
module.exports = {
mode: 'development',
entry: {
app: ['@babel/polyfill', path.resolve(__dirname, 'src/entries/app.js')]
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'js/[name].js'
},
devServer: {
port: 9000,
historyApiFallback: true
},
devtool: 'eval-source-map',
module: {
rules: [
{
// test: que tipo de archivo quiero reconocer,
// use: que loader se va a encargar del archivo
test: /\.(js|jsx)$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.(js)$/,
exclude: /(node_modules)/,
use: ['babel-loader', 'eslint-loader']
},
{
// test : que tipo de archivo quiero reconover
// use: loaders se va a encargar del archivo
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.(jpg|png|gif|svg)$/,
use: {
loader: 'url-loader',
options: {
limit: 1000000,
fallback: 'file-loader',
name: 'images/[name].[hash].[ext]',
}
}
},
{
test: /\.(config|config.js)$/,
use: {
loader: 'file-loader',
options: {
name: '[name].[ext]',
}
}
}
]
},
plugins: [
// aqui van los plugins
new MiniCssExtractPlugin({
filename: 'css/[name].css',
chunkFilename: '[id].css'
}),
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /(en|es)$/)
],
optimization: {
splitChunks: {
name: 'common',
chunks: 'initial'
}
}
}