How to exclude a module from webpack, and instead import it using es6
11,719
What you're after is the externals
option in your webpack.config.js
module.exports = {
//...
externals: {
'./MyModuleFile': 'MyModule',
}
};
Author by
Cart
Updated on July 22, 2022Comments
-
Cart almost 2 years
I am currently using webpack to bundle up a javascript file with react. This file also has another import statement to another module within my project
import { MyModule} from './MyModuleFile.js'
Is there a way to exclude MyModule.js from the webpack bundle, and instead keep the import as is?