babel-plugin-alias

1.2.1 • Public • Published

babel-plugin-alias

This is an alias conversion babel plugin

Install

install with npm:

npm install --save-dev babel-plugin-alias

install with yarn:

yarn add babel-plugin-alias -dev

Quickstart

Usage 1: integrate into typescript

  1. config tsconfig.json demo(paths is the same as what you normally configure):
{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "@test/*": ["./test/*"]
    }
  },
}
  1. babel config
  // babel.config.json or .babelrc or babel.config.js
  {
    "plugins": ["babel-plugin-alias"]
  }
  1. file import
  • module test/a.ts
  import b from '@test/b';
  console.log('module a run success !!!', b);
  • module test/b.ts
  console.log('module b run success !!!');
  export default 1;

Package Sidebar

Install

npm i babel-plugin-alias

Weekly Downloads

142

Version

1.2.1

License

MIT

Unpacked Size

256 kB

Total Files

6

Last publish

Collaborators

  • drdevelop