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?
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'
}
};