|
1 | 1 | const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'); |
2 | 2 | const { sentryWebpackPlugin } = require('@sentry/webpack-plugin'); |
3 | 3 | const CircularDependencyPlugin = require('circular-dependency-plugin'); |
| 4 | + |
| 5 | +const circularPlugin = new CircularDependencyPlugin({ |
| 6 | + // exclude detection of files based on a RegExp |
| 7 | + exclude: /a\.js|node_modules/, |
| 8 | + // add errors to webpack instead of warnings |
| 9 | + failOnError: false, |
| 10 | + // allow import cycles that include an asyncronous import, |
| 11 | + // e.g. via import(/* webpackMode: "weak" */ './file.js') |
| 12 | + allowAsyncCycles: false, |
| 13 | + // set the current working directory for displaying module paths |
| 14 | + cwd: process.cwd(), |
| 15 | +}); |
| 16 | + |
| 17 | +const circularValidation = false; |
| 18 | + |
4 | 19 | const rules = [ |
5 | 20 | { |
6 | 21 | test: /\.(js|jsx|ts|tsx)$/, |
@@ -61,20 +76,7 @@ module.exports = (env) => { |
61 | 76 | project: 'neodash', |
62 | 77 | }), |
63 | 78 | ] |
64 | | - : [ |
65 | | - new ReactRefreshWebpackPlugin(), |
66 | | - // new CircularDependencyPlugin({ |
67 | | - // // exclude detection of files based on a RegExp |
68 | | - // exclude: /a\.js|node_modules/, |
69 | | - // // add errors to webpack instead of warnings |
70 | | - // failOnError: false, |
71 | | - // // allow import cycles that include an asyncronous import, |
72 | | - // // e.g. via import(/* webpackMode: "weak" */ './file.js') |
73 | | - // allowAsyncCycles: false, |
74 | | - // // set the current working directory for displaying module paths |
75 | | - // cwd: process.cwd(), |
76 | | - // }), |
77 | | - ], |
| 79 | + : [new ReactRefreshWebpackPlugin(), ...(circularValidation ? [circularPlugin] : [])], |
78 | 80 | ignoreWarnings: [/Failed to parse source map/], |
79 | 81 | }; |
80 | 82 | }; |
0 commit comments