加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rollup.config.js 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
wangcj 提交于 2020-04-23 11:30 . 说明修改
import path from 'path';
import sourcemaps from 'rollup-plugin-sourcemaps';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
async function main()
{
const plugins = [
sourcemaps(),
resolve({
browser: true,
preferBuiltins: false,
}),
commonjs({extensions: ['.js', '.ts']}),
];
const compiled = (new Date()).toUTCString().replace(/GMT/g, 'UTC');
const sourcemap = true;
const results = [];
const pkg = require('./package.json');
const banner = [
`/*!`,
` * ${pkg.name} - v${pkg.version}`,
` * Compiled ${compiled}`,
` *`,
` * ${pkg.name} is licensed under the MIT License.`,
` * http://www.opensource.org/licenses/mit-license`,
` */`,
].join('\n');
// Check for bundle folder
const basePath = __dirname;
const input = path.join(basePath, 'src/index.js');
const freeze = false;
results.push({
input,
output: [
{
banner,
file: path.join(basePath, pkg.main),
format: 'cjs',
freeze,
sourcemap,
},
{
banner,
file: path.join(basePath, pkg.module),
format: 'es',
freeze,
sourcemap,
},
],
external: ['pixi.js'],
plugins
// plugins: [jscc({values:{_IIFE:false}})].concat(plugins)
});
// The package.json file has a bundle field
// we'll use this to generate the bundle file
// this will package all dependencies
if (pkg.bundle)
{
results.push({
input,
output: {
banner,
file: path.join(basePath, pkg.bundle),
format: 'iife',
freeze,
name: 'Nice.DrawBase',
sourcemap,
extend: true,
globals: {
'pixi.js': 'PIXI'
}
},
treeshake: false,
external: ['pixi.js'],
plugins
// plugins: [jscc({values:{_IIFE:true}})].concat(plugins),
});
}
return results;
}
export default main();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化