include worker

This commit is contained in:
Xmader 2019-12-01 16:25:13 -05:00
parent f485a415d1
commit 83ef26ead1
3 changed files with 73 additions and 49 deletions

2
.gitignore vendored
View file

@ -66,3 +66,5 @@ typings/
package-lock.json
1.*
dist/cache

View file

@ -21,6 +21,7 @@
"@types/pdfkit": "^0.10.4",
"rollup": "^1.26.3",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-multi-entry": "^2.1.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^5.2.0",

View file

@ -5,6 +5,7 @@ import builtins from "rollup-plugin-node-builtins"
import nodeGlobals from "rollup-plugin-node-globals"
import json from "@rollup/plugin-json"
import fs from "fs"
import multiEntry from "rollup-plugin-multi-entry"
const getBannerText = () => {
const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf-8"))
@ -14,16 +15,7 @@ const getBannerText = () => {
return bannerText
}
export default {
input: "src/main.ts",
output: {
file: "dist/main.js",
format: "iife",
sourcemap: false,
banner: getBannerText,
// intro: "const global = typeof window === 'object' && window.window === window ? window : typeof self === 'object' && self.self === self ? self : typeof commonjsGlobal === 'object' && commonjsGlobal.global === commonjsGlobal ? commonjsGlobal : void 0"
},
plugins: [
const plugins = [
typescript({
target: "ES6",
sourceMap: false,
@ -64,4 +56,33 @@ export default {
}
},
]
}
export default [
{
input: "src/worker.ts",
output: {
file: "dist/cache/worker.js",
format: "iife",
name: "PDFWorker",
sourcemap: false,
},
plugins,
},
{
input: [
"dist/cache/worker.js",
"src/main.ts",
],
output: {
file: "dist/main.js",
format: "iife",
sourcemap: false,
banner: getBannerText,
// intro: "const global = typeof window === 'object' && window.window === window ? window : typeof self === 'object' && self.self === self ? self : typeof commonjsGlobal === 'object' && commonjsGlobal.global === commonjsGlobal ? commonjsGlobal : void 0"
},
plugins:[
...plugins,
multiEntry({ exports: false }),
],
},
]