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' } }; 'cross-fetch': 'fetch' instead. The left part match the import and the right part how to handle it and replace the import ???
fetchalready exists in global namespace provided by the serverless enviroment I use. I want the third-party module NOT to import cross-fetch and instead use the already existent global variable.const myCustomModule = eval('require')(myCustomPath)