mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 15:40:51 +01:00
50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
module.exports = {
|
|
eslint: {
|
|
enable: false
|
|
},
|
|
webpack: {
|
|
configure: (webpackConfig) => ({
|
|
...webpackConfig,
|
|
optimization: {
|
|
...webpackConfig.optimization,
|
|
splitChunks: {
|
|
cacheGroups: {
|
|
vendor: {
|
|
name: 'vendors',
|
|
test: /[\\/]node_modules[\\/]/,
|
|
chunks: 'all',
|
|
},
|
|
renderer: {
|
|
name: 'renderer',
|
|
test: /[\\/]node_modules[\\/]@nitrots[\\/]nitro-renderer[\\/]/,
|
|
chunks: 'all',
|
|
}
|
|
}
|
|
}
|
|
},
|
|
module: {
|
|
...webpackConfig.module,
|
|
rules: [
|
|
{
|
|
test: /\.mjs$/,
|
|
include: /node_modules/,
|
|
type: 'javascript/auto'
|
|
},
|
|
...webpackConfig.module.rules.map((rule) => {
|
|
if (!rule.oneOf) return rule;
|
|
|
|
return {
|
|
...rule,
|
|
oneOf: rule.oneOf.map((ruleObject) => {
|
|
if (!new RegExp(ruleObject.test).test('.ts') || !ruleObject.include) return ruleObject;
|
|
|
|
return { ...ruleObject, include: undefined };
|
|
})
|
|
};
|
|
})
|
|
]
|
|
}
|
|
})
|
|
}
|
|
}
|