nitro-react/craco.config.js

50 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2021-09-16 06:48:43 +02:00
module.exports = {
eslint: {
2021-09-17 05:47:07 +02:00
enable: false
2021-09-17 05:16:54 +02:00
},
webpack: {
configure: (webpackConfig) => ({
...webpackConfig,
2021-09-20 10:17:38 +02:00
optimization: {
...webpackConfig.optimization,
splitChunks: {
cacheGroups: {
vendor: {
name: 'vendors',
test: /[\\/]node_modules[\\/]/,
chunks: 'all',
},
renderer: {
name: 'renderer',
test: /[\\/]node_modules[\\/]@nitrots[\\/]nitro-renderer[\\/]/,
chunks: 'all',
}
}
}
2022-03-16 09:43:52 +01:00
},
module: {
...webpackConfig.module,
2022-07-25 17:45:51 +02:00
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto'
},
...webpackConfig.module.rules.map((rule) => {
if (!rule.oneOf) return rule;
2022-03-16 09:43:52 +01:00
2022-07-25 17:45:51 +02:00
return {
...rule,
oneOf: rule.oneOf.map((ruleObject) => {
if (!new RegExp(ruleObject.test).test('.ts') || !ruleObject.include) return ruleObject;
return { ...ruleObject, include: undefined };
})
};
})
]
2021-09-17 05:16:54 +02:00
}
})
2021-09-16 06:48:43 +02:00
}
}