auto-request
Version:
通过Yapi JSON Schema生成接口Axios或Taro接口
37 lines (35 loc) • 1.06 kB
JavaScript
import typescript from '@rollup/plugin-typescript';
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 格式
sourcemap: true,
exports: 'named', // 使用命名导出
},
plugins: [
resolve({ preferBuiltins: true }), // 优先使用 Node.js 内置模块
commonjs(), // 将 CommonJS 模块转换为 ES6
json(), // 支持导入 JSON 文件
typescript({
tsconfig: './tsconfig.json',
sourceMap: true,
inlineSources: true
}), // 使用 tsconfig.json 配置
],
external: [
'fs',
'path',
'readline',
'prettier',
'json-schema-to-typescript',
'camelcase',
'clone',
'yargs',
'@babel/parser',
'@babel/traverse'
], // 外部依赖
};