
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
babel-plugin-mix-import-module-exports
Advanced tools
Fix mixed use ES6 imports and Common.js exports
When mixed use import
and module.exports
:
import A from 'a';
// ...
module.exports = A
it will lead to problems with bundling like this:
TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
For more infomation, see these issues:
https://github.com/almende/vis/issues/2934
https://github.com/webpack/webpack/issues/4039#issuecomment-281136701
https://github.com/webpack/webpack/issues/3491
This plugin makes things work by transforming the code into:
var __MIX_IMPORT_MODULE_EXPORTS__;
import A from 'a';
// ...
__MIX_IMPORT_MODULE_EXPORTS__ = A;
export default __MIX_IMPORT_MODULE_EXPORTS__;
or sometimes maybe we have multiple module.exports
in our module:
var __MIX_IMPORT_MODULE_EXPORTS__;
import A from 'a';
import B from 'b';
// ...
if (B) {
__MIX_IMPORT_MODULE_EXPORTS__ = B;
} else {
__MIX_IMPORT_MODULE_EXPORTS__ = A;
}
export default __MIX_IMPORT_MODULE_EXPORTS__;
This plugin is just for compatibility with old projects, you should not use it in your new projects.
FAQs
Fix mixed use ES6 imports and Common.js exports
The npm package babel-plugin-mix-import-module-exports receives a total of 367 weekly downloads. As such, babel-plugin-mix-import-module-exports popularity was classified as not popular.
We found that babel-plugin-mix-import-module-exports demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.