-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.common.js
74 lines (73 loc) · 2.39 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
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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const Dotenv = require('dotenv-webpack');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
entry: "./src/index.js",
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'Summit Admin',
template: './src/index.ejs'
}),
new Dotenv({
expand: true
})
],
node: {fs: 'empty'},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
"@babel/preset-env",
{ "targets": { "node": "current" } }
],
'@babel/preset-react',
'@babel/preset-flow'
],
plugins: ['@babel/plugin-proposal-object-rest-spread']
}
}
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"]
},
{
test: /\.less/,
use: [MiniCssExtractPlugin.loader, "css-loader", "less-loader"]
},
{
test: /\.scss/,
exclude: /\.module\.scss/,
use: [MiniCssExtractPlugin.loader, "css-loader", 'sass-loader']
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: "url-loader?limit=10000&minetype=application/font-woff&name=fonts/[name].[ext]"
},
{
test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: "file-loader?name=fonts/[name].[ext]"
},
{
test: /\.jpg|\.png|\.gif$/,
use: "file-loader?name=images/[name].[ext]"
},
{
test: /\.svg/,
use: "file-loader?name=svg/[name].[ext]!svgo-loader"
},
{
test: /\.yaml$/,
use: 'js-yaml-loader',
}
]
},
};