1.2.1 • Published 2 years ago

babel-plugin-alias v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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;