-
-
Notifications
You must be signed in to change notification settings - Fork 268
Expand file tree
/
Copy pathcraco.config.js
More file actions
38 lines (35 loc) · 1.06 KB
/
craco.config.js
File metadata and controls
38 lines (35 loc) · 1.06 KB
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
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']
},
jest: {
configure: {
setupFiles: ['<rootDir>/src/setupPolyfills.js']
}
}
};