datamax-cli
Version:
datamax plugin cli
45 lines (42 loc) • 1.14 kB
JavaScript
const render = require("json-templater/string");
module.exports = function buildPj(config) {
let ROLLCONFIG_TEMPLATE = `/* 由datamax-cli脚手架自动生成 */
const path = require("path")
import resolve from "rollup-plugin-node-resolve"
import vue from "rollup-plugin-vue"
import commonjs from "@rollup/plugin-commonjs"
import json from '@rollup/plugin-json'
export default {
input: './packages/index.js',
output: {
file: 'dist/{{pluginName}}.js',
format: 'iife',
name: '{{pluginName}}',
globals: {
vue: "Vue" // 告诉rollup全局变量Vue即是vue
}
},
plugins: [ // 引入的插件在这里配置
resolve(),
vue({
css: true,
template:{
isProduction:true
}
}),
commonjs(),
json()
]
};
`;
let roll_template = render(ROLLCONFIG_TEMPLATE, {
pluginName: config.pluginName,
author: config.author,
description: config.description,
});
return {
template: roll_template,
dir: [config.root, config.pluginName],
file: "rollup.config.js",
};
};