
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
babel-plugin-transform-require-extensions
Advanced tools
A Babel plugin that transforms specified require path file extensions.
A Babel plugin that transforms specified require
path file extensions.
This is useful for building dual ESM/CJS packages. File names with extensions are mandatory in ESM import
specifiers in .mjs
files. After transpiling this to CJS in .js
files, the hardcoded .mjs
extensions in the require
paths must be transformed to .js
. Alternatively, sometimes it’s safe to remove the extensions as Node.js in CJS mode can automatically resolve .js
file extensions.
To install from npm run:
npm install babel-plugin-transform-require-extensions --save-dev
Configure Babel to use the plugin:
{ "plugins": ["transform-require-extensions"] }
This plugin must run after any ESM to CJS transpilation occurs.
By default .mjs
extensions are transformed to .js
. The extensions
option can be used to specify extension replacements. For example, to remove .mjs
extensions:
{
"plugins": [
[
"transform-require-extensions",
{
"extensions": {
".mjs": ""
}
}
]
]
}
2.0.1
hard-rejection
dev dependency to ensure unhandled rejections in tests exit the process with an error.test:prettier
script.semi
to the default, true
.assert
imports.FAQs
A Babel plugin that transforms specified require path file extensions.
The npm package babel-plugin-transform-require-extensions receives a total of 29 weekly downloads. As such, babel-plugin-transform-require-extensions popularity was classified as not popular.
We found that babel-plugin-transform-require-extensions 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
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.