-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
76 lines (75 loc) · 2.17 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
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
module.exports = {
entry: "./src/index.tsx",
output: {
path: path.resolve(__dirname, 'public/dist/'),
filename: 'bundle.js'
},
plugins: [
new CleanWebpackPlugin(),
new HardSourceWebpackPlugin(),
new ForkTsCheckerWebpackPlugin()
],
module: {
rules: [
{
test: /\.tsx?$/,
include: path.resolve(__dirname, 'src'),
use: [{
loader: 'ts-loader',
options: {
transpileOnly: true
}
}, 'eslint-loader', 'stylelint-custom-processor-loader'],
exclude: /node_modules/,
},
{
test: /\.(png|jpe?g|gif|ico)$/i,
include: path.resolve(__dirname, 'src'),
use: [
{
loader: 'file-loader',
},
],
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.svg$/,
include: path.resolve(__dirname, 'src'),
use: {
loader: 'svg-react-loader',
},
exclude: /node_modules/,
},
{
test: /\.(woff|woff2|ttf)$/,
include: path.resolve(__dirname, 'src'),
use: {
loader: 'url-loader',
},
},
],
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
alias: {
'@library': path.resolve(__dirname, 'src/library/'),
'@context': path.resolve(__dirname, 'src/context/'),
'@assets': path.resolve(__dirname, 'src/assets/'),
'@types': path.resolve(__dirname, 'src/types/index.ts'),
'@localizeComponent': path.resolve(__dirname, 'src/Localize/Localize.tsx'),
'@localize': path.resolve(__dirname, 'src/commonLocalize.json'),
'@helpers': path.resolve(__dirname, 'src/helpers/index.ts'),
'@theme': path.resolve(__dirname, 'src/designSystemStore.ts'),
'@mockedApi': path.resolve(__dirname, 'src/mockedApi/'),
},
modules: [path.resolve('node_modules')]
}
};