This repository was archived by the owner on Aug 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
executable file
·97 lines (96 loc) · 3.11 KB
/
webpack.config.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
const _ = require(`lodash`), MiniCssExtractPlugin = require(`mini-css-extract-plugin`);
module.exports = require(`glob`).sync(`${__dirname}/src/**/webpack.config.js`).map(file =>
_.mergeWith({
output: {
filename: `[name].js`,
publicPath: `https://${process.env.VERCEL_URL}/`,
path: `${__dirname}/public`,
libraryTarget: `system`
},
module: {
rules: [{
parser: {
system: false
}
}, {
exclude: /node_modules/,
test: /\.ts$/,
use: {
loader: `ts-loader`
}
}, {
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader, `css-loader`, {
loader: `postcss-loader`,
options: {
plugins: [
require(`autoprefixer`),
require(`cssnano`)({
preset: `default`
})
]
}
}
]
}, {
test: /\.less$/,
use: [
MiniCssExtractPlugin.loader, {
loader: `css-loader`,
options: {
importLoaders: 1,
modules: {
localIdentName: `[hash:base64:5]`
}
}
}, {
loader: `postcss-loader`,
options: {
plugins: [
require(`tailwindcss`),
require(`postcss-nested`),
require(`autoprefixer`),
require(`cssnano`)({
preset: `default`
})
]
}
}
]
}]
},
optimization: {
minimizer: [
new (require(`terser-webpack-plugin`))()
]
},
plugins: [
new MiniCssExtractPlugin({
filename: `[name].css`
})
]
}, require(file), (object, source) => _.isArray(object) ? object.concat(source) : undefined)
).concat({
entry: require(`glob`).sync(`${__dirname}/src/**/demo.js`).reduce((entries, entry) => {
entries[entry.match(/\/src\/([a-z\-]+)\/demo.js/)[1]] = entry;
return entries;
}, {}),
output: {
filename: `[name].js`,
publicPath: `https://${process.env.VERCEL_URL}/`,
path: `${__dirname}/public/demo`
},
module: {
rules: [{
parser: {
system: false
}
}]
},
optimization: {
minimizer: [
new (require(`terser-webpack-plugin`))()
]
}
});