Package Exports
- @noxx/babel-plugin-a2rp
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@noxx/babel-plugin-a2rp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Babel Plugin - Aliases to Relative Paths
Converts aliases in Strings to relative paths
Install
npm i -D @noxx/babel-plugin-a2rpUsage
First create aliases that can be utilized by the plugin. The format for the aliases Object are key value pairs where the key is the alias, and value is the actual path that maps to a specific directory.
// aliases.js
const { resolve } = require('path');
const ROOT = resolve(__dirname, './');
const SRC = `${ ROOT }/src`;
module.exports = {
COMPONENTS: `${ SRC }/components`,
SERVER: `${ SRC }/server`,
};In your babel.config.js file, add the plugin at the top of the plugins list
to ensure aliases are replaced and paths are resolved correctly.
const aliases = require('./aliases');
module.exports = (api) => {
api.cache(true);
return {
plugins: [
['@noxx/babel-plugin-a2rp', { aliases }],
// other plugins
],
};
};