auto-request
Version:
通过Yapi JSON Schema生成接口Axios或Taro接口
20 lines (18 loc) • 782 B
JavaScript
import typescript from 'rollup-plugin-typescript2';
import resolve from '@rollup/plugin-node-resolve'; // 用于解析第三方模块
import commonjs from '@rollup/plugin-commonjs'; // 将 CommonJS 模块转换为 ES6
import json from '@rollup/plugin-json'; // 支持导入 JSON 文件
export default {
input: 'src/index.ts',
output: {
file: 'dist/bundle.js',
format: 'cjs', // 输出为 CommonJS 格式
},
plugins: [
resolve({ preferBuiltins: true }), // 优先使用 Node.js 内置模块
commonjs(), // 将 CommonJS 模块转换为 ES6
json(), // 支持导入 JSON 文件
typescript(), // 自动读取 tsconfig.json 配置
],
external: ['fs', 'path', 'readline', 'prettier', 'json-schema-to-typescript'], // 外部依赖
};