【文件属性】:
文件名称:babel-plugin-root-import:添加通过根路径导入模块的机会
文件大小:81KB
文件格式:ZIP
更新时间:2021-01-30 03:21:52
babel es6 tdd babel-plugin BabelJavaScript
Babel插件增加了使用import和require的机会,并带有基于root的路径。
例
// Without this plugin...
import SomeExample from '../../../some/example.js' ;
const OtherExample = require ( '../../../other/example.js' ) ;
import ( '../../../other/dynamic' ) . then ( ( mod ) => {
// ...
} ) ;
// With babel-plugin-root-import you can write...
import SomeExample from '~/some/example.js' ;
const OtherExample = require ( '~/other/example.js' ) ;
import ( '~/other/dynamic' ) . then ( ( mod ) => {
// ...
} ) ;
安装
使用您选择的软件包管理器进行安装。
【文件预览】:
babel-plugin-root-import-master
----.gitignore(33B)
----.babelrc(38B)
----.eslintrc(7KB)
----package.json(2KB)
----.travis.yml(35B)
----LICENSE(1KB)
----index.js(79B)
----babel6(62B)
----.prettierrc.js(172B)
----README.md(10KB)
----plugin()
--------index.js(3KB)
--------call-expression-tester.js(940B)
--------helper.js(1KB)
----config()
--------mocha.js(124B)
----test()
--------plugin.spec.js(11KB)
--------set-babel7.js(33B)
--------helper.spec.js(4KB)
--------babel-helpers.js(850B)
--------.babelrc.js(180B)
--------call-expression-tester.spec.js(3KB)
----babel7(63B)
----yarn.lock(184KB)