36 Star 166 Fork 45

Gitee 极速下载/Maptalks

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/maptalks/maptalks.js
克隆/下载
rollup.config.js 2.89 KB
一键复制 编辑 原始数据 按行查看 历史
deyihu 提交于 2024-04-23 16:34 . bundle d.ts files (#2311)
const commonjs = require('@rollup/plugin-commonjs'),
resolve = require('@rollup/plugin-node-resolve'),
babel = require('@rollup/plugin-babel'),
json = require('@rollup/plugin-json'),
typescript = require('@rollup/plugin-typescript'),
terser = require('@rollup/plugin-terser');
const pkg = require('./package.json');
const { dts } = require("rollup-plugin-dts");
const testing = process.env.BUILD === 'test';
const dev = process.env.BUILD === 'dev';
const isDebug = testing || dev;
const plugins = testing ?
[
// ['istanbul', {
// // TileLayerGLRenderer is not testable on CI
// exclude: ['test/**/*.js', 'src/core/mapbox/*.js', 'src/util/dom.js', 'src/renderer/layer/tilelayer/TileLayerGLRenderer.js', 'src/renderer/layer/ImageGLRenderable.js', 'node_modules/**/*']
// }]
]
:
[];
const year = new Date().getFullYear();
const banner = `/*!\n * ${pkg.name} v${pkg.version}\n * LICENSE : ${pkg.license}\n * (c) 2016-${year} maptalks.org\n */`;
const outro = `typeof console !== 'undefined' && console.log && console.log('${pkg.name} v${pkg.version}');`;
const rollupPlugins = [
json(),
resolve({
module: true,
jsnext: true,
main: true
}),
commonjs(),
typescript()
];
// const compilePlugins = [
// babel({
// plugins,
// babelHelpers: 'bundled'
// })
// ];
// if (!isDebug) {
// rollupPlugins.push(terser(), ...compilePlugins)
// } else {
// rollupPlugins.push(...compilePlugins);
// }
// const external = ['rbush', 'frustum-intersects', 'simplify-js'];
const builds = [
{
input: 'src/index.ts',
plugins: rollupPlugins,
output: [
{
'sourcemap': true,
'format': 'umd',
'name': 'maptalks',
banner,
outro,
'file': pkg.main
}
]
},
{
input: 'dist/index.d.ts',
plugins: [dts()],
output: [
{
'sourcemap': true,
'format': 'es',
'name': 'maptalks',
banner,
'file': pkg['d.ts']
}
]
},
{
input: 'src/index.ts',
plugins: rollupPlugins.concat([terser()]),
output: [
{
'sourcemap': false,
'format': 'umd',
'name': 'maptalks',
banner,
outro,
'file': pkg.minify
}
]
},
//for browser esm
{
input: 'src/index.ts',
plugins: rollupPlugins,
output: [
{
'sourcemap': true,
'format': 'es',
banner,
'file': pkg.module_browser
}
]
}
];
if (isDebug) {
module.exports = builds.slice(0, 2);
} else {
module.exports = builds;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mirrors/Maptalks.git
git@gitee.com:mirrors/Maptalks.git
mirrors
Maptalks
Maptalks
master

搜索帮助