-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.common.js
57 lines (55 loc) ยท 1.58 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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const dotenv = require('dotenv');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
dotenv.config();
module.exports = {
entry: './src/app/Index.tsx',
output: {
path: path.join(__dirname, './dist'),
filename: '[name].js',
publicPath: '/'
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@/components': path.resolve(__dirname, './src/components')
},
extensions: ['.js', '.jsx', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.tsx?$/,
use: ['babel-loader', 'ts-loader'],
exclude: /node_modules/
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader']
},
{
test: /\.(png|jpe?g|gif|svg)$/i,
type: 'asset/resource',
generator: {
filename: 'assets/[name][ext]'
}
}
]
},
plugins: [
new webpack.ProvidePlugin({
React: 'react'
}),
new HtmlWebpackPlugin({
template: './public/index.html'
}),
new CleanWebpackPlugin(),
new webpack.DefinePlugin({
'process.env': JSON.stringify(process.env)
}),
new FaviconsWebpackPlugin('./public/favicon.png')
]
};