@expo/webpack-config
Version:
The default Webpack configuration used to build Expo apps targeting the web.
14 lines • 732 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
function withNodeMocks(webpackConfig) {
if (typeof webpackConfig.target === 'string' &&
['electron', 'electron-main', 'node'].includes(webpackConfig.target)) {
return webpackConfig;
}
webpackConfig.node = Object.assign({ module: 'empty', dgram: 'empty', dns: 'mock', fs: 'empty', http2: 'empty', net: 'empty', tls: 'empty', child_process: 'empty' }, (webpackConfig.node || {}));
return webpackConfig;
}
exports.default = withNodeMocks;
//# sourceMappingURL=withNodeMocks.js.map