-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
82 lines (79 loc) · 1.76 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
82
const path = require('path')
const { CheckerPlugin } = require('awesome-typescript-loader')
const rootPathTo = pathFromRoot => path.resolve(__dirname, pathFromRoot)
const babelOptions = {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage'
}
]
]
}
module.exports = {
entry: {
index: './client/scripts/index.ts',
styles: './client/styles/styles.js'
},
output: {
path: rootPathTo('dist/client/scripts'),
publicPath: '/dist/client/'
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
'awesome-typescript-loader',
{ loader: 'babel-loader', options: babelOptions }
]
},
{
test: /\.p?css$/,
use: [
'style-loader',
{ loader: 'css-loader', options: { importLoaders: 1 } },
'postcss-loader'
]
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
use: [
{ loader: 'file-loader', options: { publicPath: '/static/scripts/' } }
]
},
// Remove the massive Unicode table pulled in by the `slug` package.
// https://www.npmjs.com/package/slug
// https://stackoverflow.com/questions/41873334/webpack-browserify-ignore-equivalent
{
test: /unicode\/category\/So\.js$/,
use: [
{ loader: 'null-loader' }
]
}
]
},
context: __dirname,
target: 'web',
plugins: [
new CheckerPlugin()
],
// https://webpack.js.org/configuration/stats/
stats: {
chunks: false,
colors: true,
modules: false,
performance: false,
warnings: true
},
performance: {
hints: false
}
}