-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathwebpack.config.js
More file actions
27 lines (24 loc) · 951 Bytes
/
webpack.config.js
File metadata and controls
27 lines (24 loc) · 951 Bytes
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
/* eslint-env node */
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
// Ensure import.meta is properly transformed
config.module.rules.forEach((rule) => {
if (rule.oneOf) {
rule.oneOf.forEach((oneOfRule) => {
if (oneOfRule.use && Array.isArray(oneOfRule.use) && oneOfRule.use.some((use) => use.loader && use.loader.includes('babel-loader'))) {
oneOfRule.exclude = (input) => {
// Don't exclude problematic packages from transpilation
const shouldTranspile = /node_modules\/(acorn|cjs-module-lexer|@eslint|sucrase)/.test(input);
if (shouldTranspile) {
return false;
}
// Exclude other node_modules
return /node_modules/.test(input);
};
}
});
}
});
return config;
};