
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
babel-plugin-transform-inline-imports-commonjs
Advanced tools
A Babel transform that turns imports into lazily loaded commonjs requires
This plugin should be used instead of babel-plugin-transform-es2015-modules-commonjs
$ npm install babel-plugin-transform-inline-imports-commonjs
This plugin transforms ES modules (import
and export
), into CommonJS require
and module.exports
. import
s are transformed into lazily loaded memoized require
s. So the require
call is deferred until the imported identifier is referenced. This allows you to write idiomatic code without the performance costs of loading code up-front (I/O, parsing, and executing).
Before:
import bigModule from 'big-module';
export default function(val) {
return bigModule.doExpensiveThing(val);
}
After:
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (val) {
return (_bigModule || _bigModule2()).default.doExpensiveThing(val);
};
var _bigModule;
function _bigModule2() {
return _bigModule = _interopRequireDefault(require('big-module'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
The same settings that are available for babel-plugin-transform-es2015-modules-commonjs
are available for babel-plugin-transform-inline-imports-commonjs
:
// without options
{
"plugins": ["transform-inline-imports-commonjs"]
}
// with options
{
"plugins": [
["transform-inline-imports-commonjs", {
"allowTopLevelThis": true,
"strict": false,
"loose": true
}]
]
}
excludeModules
:
"excludeModules": ["atom"]
:import {TextEditor} from 'atom'; // transforms to plain `require` with interop
import foo from 'bar'; // transforms to inline import
excludeNodeBuiltins
(default: false
)
import * as path from 'path'; // transforms to plain `require` with interop
import foo from 'bar'; // transforms to inline import
v1.2.0 (2016-10-19)
excludeModules
option.FAQs
A Babel transform that turns imports into lazily loaded commonjs requires
The npm package babel-plugin-transform-inline-imports-commonjs receives a total of 977 weekly downloads. As such, babel-plugin-transform-inline-imports-commonjs popularity was classified as not popular.
We found that babel-plugin-transform-inline-imports-commonjs 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.