12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import nodeResolve from '@rollup/plugin-node-resolve'
- import commonjs from "@rollup/plugin-commonjs"
- import babel from '@rollup/plugin-babel'
- import { uglify } from 'rollup-plugin-uglify'
- import json from '@rollup/plugin-json';
- import ts from "rollup-plugin-typescript2"
- const extensions = [".js", ".ts"]
- const plugins = [
- json(),
- ts(),
- nodeResolve({
- preferBuiltins: true,
- mainFields: ['browser']
- }),
- commonjs(),
- // (uglify()),
- // (process.env === 'production' && uglify()),
- babel({
- extensions,
- exclude: 'node_modules/**', // 防止打包node_modules下的文件
- // 使用预设
- presets: [['@babel/preset-env', {
- "modules": false,
- // 目标浏览器
- "targets": {
- "edge": '17',
- "firefox": '60',
- "chrome": '67',
- "safari": '10.0',
- 'ie': '10',
- },
- }]]
- })
- ]
- export default [{
- input: "./src/worker/compdfkit.worker.js",
- output: [
- {
- format: "es",
- file: "../webviewer/lib/pdfviewer.worker.js",
- sourceMap: true
- }
- ],
- plugins
- },
- {
- input: "./src/index.ts",
- output: [
- {
- format: "es",
- file: "../webviewer/lib/webview.min.js",
- sourceMap: true
- }
- ],
- plugins
- }];
|