Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
webpack(config: AnyConfiguration, options: any): AnyConfiguration {
const expoConfig = withUnimodules(
config,
{
projectRoot: nextConfig.projectRoot || process.cwd(),
},
{ supportsFontLoading: false }
);
// Use original public path
(expoConfig.output || {}).publicPath = (config.output || {}).publicPath;
// TODO: Bacon: use commonjs for RNW babel maybe...
if (typeof nextConfig.webpack === 'function') {
return nextConfig.webpack(expoConfig, options);
}
return expoConfig;
},
function onCreateWebpackConfig({ actions, getConfig }) {
const gatsbyConfig = getConfig()
if (!gatsbyConfig.context) {
throw new Error('Expected Gatsby config to provide the root context')
}
let config
try {
config = withUnimodules(gatsbyConfig)
} catch (error) {
console.error(error)
process.exit(1)
}
actions.replaceWebpackConfig(config)
}
async function createWebpackConfigAsync(
env: Web.WebEnvironment,
options: CLIWebOptions = {}
): Promise {
setMode(env.mode);
let config;
if (options.unimodulesOnly) {
const { withUnimodules } = require('@expo/webpack-config/addons');
config = withUnimodules({}, env);
} else {
config = await Web.invokeWebpackConfigAsync(env);
}
return config;
}