基于Webpack的RAML加载器设计与实现

RAML 加载器:Webpack 集成方案

RAML 加载器能够将 RAML 规范转换为 CommonJS 模块,简化 Webpack 项目中的 API 集成流程。

使用方法

import MyAPI from "./api/MyAPI.raml";
console.warn("the title of the API is", MyAPI.title);

Webpack 配置建议

{
  module: {
    loaders: [
      {
        test: /.raml$/,
        loader: "raml"
      }
    ]
  }
}

安装

npm install raml-loader
zip 文件大小:5.14KB