I am importing a third-party module which imports another module:
import fetch from "cross-fetch";
I would like to tell Webpack to ignore/remove this import because the variable fetch already exists in global namespace. Is that possible?
You can specify that some module is in the global env with externals.
// webpack.config.js
module.exports = {
//...
externals: {
'cross-fetch': 'fetch'
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With