Ignore proxy-polyfill in workers (#6011)

This commit is contained in:
Paulus Schoutsen 2020-05-24 01:41:05 -07:00 committed by GitHub
parent c5ef33cc78
commit 38d3b8d087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 10 deletions

View File

@ -11,7 +11,8 @@ module.exports.ignorePackages = ({ latestBuild }) => [
]; ];
// Files from NPM packages that we should replace with empty file // Files from NPM packages that we should replace with empty file
module.exports.emptyPackages = ({ latestBuild }) => [ module.exports.emptyPackages = ({ latestBuild }) =>
[
// Contains all color definitions for all material color sets. // Contains all color definitions for all material color sets.
// We don't use it // We don't use it
require.resolve("@polymer/paper-styles/color.js"), require.resolve("@polymer/paper-styles/color.js"),
@ -19,7 +20,9 @@ module.exports.emptyPackages = ({ latestBuild }) => [
// Loads stuff from a CDN // Loads stuff from a CDN
require.resolve("@polymer/font-roboto/roboto.js"), require.resolve("@polymer/font-roboto/roboto.js"),
require.resolve("@vaadin/vaadin-material-styles/font-roboto.js"), require.resolve("@vaadin/vaadin-material-styles/font-roboto.js"),
]; // Polyfill only needed for ES5 workers so filter out in latestBuild
latestBuild && require.resolve("proxy-polyfill/src/index.js"),
].filter(Boolean);
module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({ module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
__DEV__: !isProdBuild, __DEV__: !isProdBuild,

View File

@ -25,7 +25,7 @@ const defaultOpts = {
// A RegExp to find `new Workers()` calls. The second capture group _must_ // A RegExp to find `new Workers()` calls. The second capture group _must_
// capture the provided file name without the quotes. // capture the provided file name without the quotes.
workerRegexp: /new Worker\((["'])(.+?)\1(,[^)]+)?\)/g, workerRegexp: /new Worker\((["'])(.+?)\1(,[^)]+)?\)/g,
plugins: ["node-resolve", "commonjs", "babel"], plugins: ["node-resolve", "commonjs", "babel", "terser", "ignore"],
}; };
async function getBundledWorker(workerPath, rollupOptions) { async function getBundledWorker(workerPath, rollupOptions) {