forked from PetrSvirak/kentico-onboarding-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
58 lines (57 loc) · 1.54 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
/* eslint-disable object-curly-newline */
/* eslint-disable object-property-newline */
/* eslint-disable no-path-concat */
const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
entry: {
client: './src/index.tsx'
},
output: {
path: path.resolve(__dirname, 'build'),
filename: '[name].js',
},
module: {
rules: [
{ test: /\.(js|jsx)$/, exclude: /node_modules/, use: [
'babel-loader',
'eslint-loader'
] },
{ test: /\.(ts|tsx)$/, exclude: /node_modules/, use: [
'ts-loader',
{ loader: 'tslint-loader', options: { configFile: 'tslint.json' } }
] },
{ test: /\.css$/, use: [
{ loader: 'file-loader', options: { name: 'styles/[name].[ext]' } },
{ loader: 'extract-loader', options: { publicPath: '../' } },
{ loader: 'css-loader' }
] },
{ test: /\.(eot|svg|ttf|woff|woff2)/, use: [
{ loader: 'url-loader', options: { name: 'font-icons/[name].[ext]', limit: 10000 } }
] },
{ test: /\.(html|jpg|jpeg|png|ico|gif)/, use: [
{ loader: 'file-loader', options: { name: '[path][name].[ext]', context: 'public' } }
] }
]
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /node_modules/,
chunks: 'all',
name: 'vendor',
}
}
}
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
plugins: [
new CleanWebpackPlugin(['build/*'])
],
stats: {
colors: true,
},
};