-
Notifications
You must be signed in to change notification settings - Fork 17
/
craco.config.js
65 lines (64 loc) · 1.53 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
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
const { whenDev } = require('@craco/craco');
const CracoEsbuildPlugin = require('craco-esbuild');
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const CracoLessPlugin = require('craco-less');
const path = require('path');
const pathResolve = (pathUrl) => path.join(__dirname, pathUrl);
module.exports = {
webpack: {
configure: {
output: {
filename: 'static/js/bundle.js',
},
optimization: {
runtimeChunk: false,
splitChunks: {
chunks(chunk) {
return false;
},
},
},
},
alias: {
'@': pathResolve('.'),
src: pathResolve('src'),
common: pathResolve('src/common'),
components: pathResolve('src/components'),
hooks: pathResolve('src/hooks'),
utils: pathResolve('src/utils'),
},
plugins: [
new SimpleProgressWebpackPlugin({
format: 'compact',
}),
...whenDev(
() => [
new CircularDependencyPlugin({
exclude: /node_modules/,
include: /src/,
failOnError: true,
allowAsyncCycles: false,
cwd: process.cwd(),
}),
],
[]
),
],
},
plugins: [
{
plugin: CracoEsbuildPlugin,
},
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
javascriptEnabled: true,
},
},
},
},
],
};