加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rollup.config.js 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
forest 提交于 2021-05-01 13:14 . ✨ feat: 表单可以拖拽排序
import json from '@rollup/plugin-json'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
// import { babel } from '@rollup/plugin-babel'
// import postcss from 'rollup-plugin-postcss-modules'
import postcss from 'rollup-plugin-postcss'
import typescript from 'rollup-plugin-typescript2'
import dts from 'rollup-plugin-dts'
import { terser } from 'rollup-plugin-terser'
// import peerDepsExternal from 'rollup-plugin-peer-deps-external'
const production = !process.env.ROLLUP_WATCH
export default [
{
input: 'src/visual-editor.tsx',
output: [
{
file: 'dist/visual-editor.esm.js',
format: 'es',
sourcemap: true,
},
{
file: 'dist/visual-editor.cjs.js',
format: 'cjs',
sourcemap: true,
exports: 'auto',
},
],
plugins: [
// peerDepsExternal({
// packageJsonPath: 'package.json',
// }),
resolve({
preferBuiltins: false,
}),
commonjs(),
// babel({
// exclude: '**/node_modules/**',
// }),
json(),
postcss({
extract: 'index.css',
plugins: [],
}),
typescript(),
production && terser(),
],
external: (id) => {
const external = [
'antd',
'lodash',
'moment',
'sortablejs',
'@ant-design/icons',
'react',
'react-dom',
'react-draggable',
'react-infinite-viewer',
'react-moveable',
'react-split-pane',
'immer',
'@monaco-editor/react',
'@scena/react-guides',
]
return external.includes(id) || /^(react|rc|antd)/.test(id)
},
},
// 打包声明文件
{
input: 'src/index.d.tsx',
output: [{ file: 'dist/index.d.ts', format: 'umd' }],
plugins: [dts()],
},
]
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化