Skip to content

Commit

Permalink
fix(web worker mangling issue): web worker mangling issue
Browse files Browse the repository at this point in the history
  • Loading branch information
karamalie committed Nov 25, 2021
1 parent c1c09da commit 1c2632c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"rollup-plugin-serve": "^1.0.3",
"rollup-plugin-terser": "^6.1.0",
"rollup-plugin-typescript2": "^0.27.1",
"rollup-plugin-uglify": "^6.0.4",
"rollup-plugin-visualizer": "^4.0.4",
"semantic-release": "^17.4.2",
"typescript": "^3.4.5"
Expand Down
9 changes: 8 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ export default {
port: 10001,
}),

production && terser(),
production &&
// uglify({ mangle: false }),
terser({
compress: {},
mangle: {
reserved: ["_workerSelf"],
},
}),
],
};
7 changes: 1 addition & 6 deletions src/lottie-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,7 @@ export class LottiePlayer extends LitElement {
}

if (this.webworkers) {
// lottie.useWebWorker(true);
const blob = new Blob([this.workerString], {
type: "text/javascript",
});
const url = URL.createObjectURL(blob);
new Worker(url);
lottie.useWebWorker(true);
}

// Initialize lottie player and load animation
Expand Down
33 changes: 28 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8084,6 +8084,14 @@ jest-regex-util@^27.0.6:
resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-27.0.6.tgz#02e112082935ae949ce5d13b2675db3d8c87d9c5"
integrity sha512-SUhPzBsGa1IKm8hx2F4NfTGGp+r7BXJ4CulsZ1k2kI+mGLG+lxGrs76veN2LF/aUdGosJBzKgXmNCw+BzFqBDQ==

jest-worker@^24.0.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5"
integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==
dependencies:
merge-stream "^2.0.0"
supports-color "^6.1.0"

jest-worker@^26.0.0:
version "26.6.2"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed"
Expand Down Expand Up @@ -11598,6 +11606,16 @@ rollup-plugin-typescript2@^0.27.1:
resolve "1.17.0"
tslib "2.0.1"

rollup-plugin-uglify@^6.0.4:
version "6.0.4"
resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-6.0.4.tgz#65a0959d91586627f1e46a7db966fd504ec6c4e6"
integrity sha512-ddgqkH02klveu34TF0JqygPwZnsbhHVI6t8+hGTcYHngPkQb5MIHI0XiztXIN/d6V9j+efwHAqEL7LspSxQXGw==
dependencies:
"@babel/code-frame" "^7.0.0"
jest-worker "^24.0.0"
serialize-javascript "^2.1.2"
uglify-js "^3.4.9"

rollup-plugin-visualizer@^4.0.4:
version "4.2.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-4.2.2.tgz#edeb8b3fc6f49b3c95f6cc668f4eba57c6112099"
Expand All @@ -11608,11 +11626,6 @@ rollup-plugin-visualizer@^4.0.4:
source-map "^0.7.3"
yargs "^16.2.0"

rollup-plugin-web-worker-loader@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-web-worker-loader/-/rollup-plugin-web-worker-loader-1.6.1.tgz#9d7a27575b64b0780fe4e8b3bc87470d217e485f"
integrity sha512-4QywQSz1NXFHKdyiou16mH3ijpcfLtLGOrAqvAqu1Gx+P8+zj+3gwC2BSL/VW1d+LW4nIHC8F7d7OXhs9UdR2A==

rollup@^2.23.0:
version "2.44.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.44.0.tgz#8da324d1c4fd12beef9ae6e12f4068265b6d95eb"
Expand Down Expand Up @@ -11770,6 +11783,11 @@ send@0.17.1:
range-parser "~1.2.1"
statuses "~1.5.0"

serialize-javascript@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61"
integrity sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==

serialize-javascript@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-3.1.0.tgz#8bf3a9170712664ef2561b44b691eafe399214ea"
Expand Down Expand Up @@ -12962,6 +12980,11 @@ uglify-js@^3.1.4:
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.14.2.tgz#d7dd6a46ca57214f54a2d0a43cad0f35db82ac99"
integrity sha512-rtPMlmcO4agTUfz10CbgJ1k6UAoXM2gWb3GoMPPZB/+/Ackf8lNWk11K4rYi2D0apgoFRLtQOZhb+/iGNJq26A==

uglify-js@^3.4.9:
version "3.14.3"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.14.3.tgz#c0f25dfea1e8e5323eccf59610be08b6043c15cf"
integrity sha512-mic3aOdiq01DuSVx0TseaEzMIVqebMZ0Z3vaeDhFEh9bsc24hV1TFvN74reA2vs08D0ZWfNjAcJ3UbVLaBss+g==

uid-number@0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81"
Expand Down

0 comments on commit 1c2632c

Please sign in to comment.