-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
82 lines (80 loc) · 2.09 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
75
76
77
78
79
80
81
const path = require('path');
const autoprefixer = require('autoprefixer');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const Dotenv = require('dotenv-webpack');
module.exports = {
entry: {
app: './src/index.jsx',
vendors: ['react', 'react-dom', 'react-router-dom', "@emotion/react", "@emotion/styled" ],
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader', 'eslint-loader'],
},
{
test: /\.(css|less)$/i,
use: [
'style-loader',
'css-loader',
{
loader: 'less-loader', // compiles Less to CSS
options: {
lessOptions: { // If you are using less-loader@5 please spread the lessOptions to options directly
modifyVars: {
'@primary-color': '#FEC8D8',
'@link-color': '#FEC8D8',
'@border-radius-base': '2px',
},
javascriptEnabled: true,
},
},
},
{
loader: 'postcss-loader',
options: {
plugins: () => [autoprefixer()],
},
},
],
},
{
test: /\.(png|jpe?g|gif|svg|ico)$/i,
use: [
{
loader: 'file-loader',
},
],
},
],
},
resolve: {
extensions: ['.js', '.jsx'],
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
plugins: [
new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }),
new Dotenv({
path: './.env',
}),
new HtmlWebpackPlugin({
title: 'Tokemon',
meta: {
viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no',
},
favicon: 'src/public/favicon.ico',
// filename: "index.html",
// template: path.resolve(__dirname, "dist", "index.html"),
showErrors: true,
}),
],
output: {
filename: '[name].bundle.js',
chunkFilename: '[name].[chunkhash].bundle.js',
},
};