1.0.2 • Published 11 months ago

babel-plugin-precall v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

babel-plugin-precall

babel 预执行插件

插件功能

自动引入配置的模块

引入插件

 npm install babel-plugin-precall --save-dev

插件配置

// babel.config.js
module.exports = {
  presets: [
    // other presets
  ],
  plugins: [
    [
      "babel-plugin-precall",
      {
        value: "precall",
      },
    ],
  ],
};

使用

根据以上配置插件执行结果如下

// 输入内容
precall(`
    // 此处可编写 node 模块代码, 如读取文件等操作
    module.exports=1+1
  `);
// 输出内容
2;
// 输入内容
precall`
    // 此处可编写 node 模块代码, 如读取文件等操作
    module.exports=1+1
  `;
// 输出内容
2;
1.0.2

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago