Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
babel-plugin-module-resolver-standalone
Advanced tools
Module resolver plugin for Babel usable in both Node.js the web browser environments
A Babel plugin to add a new resolver for your modules when compiling your code using Babel. This plugin allows you to transform the path of each source module using a custom JavaScript function.
This plugin can be used instead of babel-plugin-module-resolver, if the target environment is a web browser using @babel/standalone, with which the original plugin does not work. This plugin supports only the method resolvePath for the time being.
This module can be installed in your project using NPM or Yarn. Make sure, that you use Node.js version 6 or newer.
npm i -D babel-plugin-module-resolver-standalone
yarn add babel-plugin-module-resolver-standalone
Prepend path to utility modules to be able to import them from utils/...
without always providing the actual full path:
{
plugins: [
[
'module-resolver',
{
resolvePath: function (sourcePath, currentFile, opts) {
if (sourcePath.startsWith('utils/')) {
return '../../'+ sourcePath
}
}
}
]
]
}
Ensure, that all JavaScript module paths are prefixed by es6!
, so that requirejs-babel will be applied by RequireJS to nested modules too:
{
plugins: [
'transform-modules-amd',
[
'module-resolver',
{
resolvePath: function (sourcePath, currentFile, opts) {
// Avoid prefixing modules handled by other plugins.
if (sourcePath.indexOf('!') < 0) {
return 'es6!' + sourcePath;
}
}
}
]
]
}
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.
Copyright (c) 2019 Ferdinand Prantl
Licensed under the MIT license.
FAQs
Module resolver plugin for Babel usable in both Node.js the web browser environments
The npm package babel-plugin-module-resolver-standalone receives a total of 247 weekly downloads. As such, babel-plugin-module-resolver-standalone popularity was classified as not popular.
We found that babel-plugin-module-resolver-standalone 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.