-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
craco.config.js
33 lines (30 loc) · 994 Bytes
/
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
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
webpack: {
entry: './src/index.js',
plugins: [new NodePolyfillPlugin({ excludeAliases: ['console'] })],
resolve: {
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx']
},
configure: (webpackConfig, { env, paths }) => {
const isCordovaDebug = process.argv.includes('--cordova-debug');
if (isCordovaDebug) {
webpackConfig.mode = 'development';
webpackConfig.optimization = { minimize: false };
console.log('Cordova debug mode enabled');
}
webpackConfig.ignoreWarnings = [
function ignoreSourcemapsloaderWarnings(warning) {
return (
warning.module?.resource.includes('node_modules') &&
warning.details?.includes('source-map-loader')
);
}
];
return webpackConfig;
}
},
babel: {
plugins: ['babel-plugin-transform-import-meta']
}
};