forked from star-whale/starwhale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.js
40 lines (39 loc) · 1.71 KB
/
craco.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
const path = require('path')
const webpack = require('webpack')
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
const CracoEsbuildPlugin = require('craco-esbuild')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
module.exports = {
plugins: [{ plugin: CracoEsbuildPlugin }],
webpack: {
alias: {
'@user': path.resolve(__dirname, 'src/domain/user'),
'@model': path.resolve(__dirname, 'src/domain/model'),
'@project': path.resolve(__dirname, 'src/domain/project'),
'@dataset': path.resolve(__dirname, 'src/domain/dataset'),
'@job': path.resolve(__dirname, 'src/domain/job'),
'@base': path.resolve(__dirname, 'src/domain/base'),
'@': path.resolve(__dirname, 'src/'),
},
plugins: [
new SimpleProgressWebpackPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.DEBUG': JSON.stringify(process.env.DEBUG),
'process.env.PROXY': JSON.stringify(process.env.PROXY),
}),
// new BundleAnalyzerPlugin(),
],
configure: (webpackConfig, { env, paths }) => {
// https://github.com/pmndrs/react-spring/issues/1078#issuecomment-752143468
webpackConfig.module.rules.push({
test: /react-spring/,
sideEffects: true,
})
webpackConfig.optimization.minimize = false
webpackConfig.optimization.chunkIds = 'named'
webpackConfig.optimization.concatenateModules = false
return webpackConfig
},
},
}