Fix ES5 build, fix virtualizer polyfill (#7451)

This commit is contained in:
Bram Kragten
2020-10-22 22:43:15 +02:00
parent 3de78cca2d
commit a2d9f9b417
9 changed files with 46 additions and 20 deletions

View File

@@ -55,7 +55,6 @@ module.exports.babelOptions = ({ latestBuild }) => ({
!latestBuild && [
require("@babel/preset-env").default,
{
modules: false,
useBuiltIns: "entry",
corejs: "3.6",
},
@@ -71,7 +70,6 @@ module.exports.babelOptions = ({ latestBuild }) => ({
// Only support the syntax, Webpack will handle it.
"@babel/plugin-syntax-import-meta",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-top-level-await",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
[

View File

@@ -51,9 +51,6 @@ const createWebpackConfig = ({
}),
],
},
experiments: {
topLevelAwait: true,
},
plugins: [
new ManifestPlugin({
// Only include the JS of entrypoints
@@ -98,6 +95,15 @@ const createWebpackConfig = ({
new RegExp(bundle.emptyPackages({ latestBuild }).join("|")),
path.resolve(paths.polymer_dir, "src/util/empty.js")
),
// We need to change the import of the polyfill for EventTarget, so we replace the polyfill file with our customized one
new webpack.NormalModuleReplacementPlugin(
new RegExp(
require.resolve(
"lit-virtualizer/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js"
)
),
path.resolve(paths.polymer_dir, "src/resources/EventTarget-ponyfill.js")
),
],
resolve: {
extensions: [".ts", ".js", ".json"],