babel-plugin-alias
v1.2.1
Published
This is an alias conversion babel plugin
Downloads
521
Maintainers
Readme
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
- config tsconfig.json demo(paths is the same as what you normally configure):
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@test/*": ["./test/*"]
}
},
}
- babel config
// babel.config.json or .babelrc or babel.config.js
{
"plugins": ["babel-plugin-alias"]
}
- 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;