Skip to content

Commit

Permalink
Revert "Use ES modules and dynamic import for Webpack latest builds (… (
Browse files Browse the repository at this point in the history
#16679)

Revert "Use ES modules and dynamic import for Webpack latest builds (#16620)"

This reverts commit 7b350e3.
  • Loading branch information
bramkragten committed May 30, 2023
1 parent 5218e13 commit d914fb0
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
6 changes: 0 additions & 6 deletions .browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ supports es6-module-dynamic-import
not Safari < 13
not iOS < 13

# Exclude KaiOS, QQ, and UC browsers due to lack of sufficient feature support data
# Babel ignores these automatically, but we need here for Webpack to output ESM with dynamic imports
not KaiOS > 0
not QQAndroid > 0
not UCAndroid > 0

# Exclude unsupported browsers
not dead

Expand Down
1 change: 0 additions & 1 deletion build-scripts/bundle.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ module.exports.htmlMinifierOptions = {
module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({
safari10: !latestBuild,
ecma: latestBuild ? 2015 : 5,
module: latestBuild,
format: { comments: false },
sourceMap: !isTestBuild,
});
Expand Down
5 changes: 2 additions & 3 deletions build-scripts/webpack.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const createWebpackConfig = ({
return {
name,
mode: isProdBuild ? "production" : "development",
target: `browserslist:${latestBuild ? "modern" : "legacy"}`,
target: ["web", latestBuild ? "es2017" : "es5"],
// For tests/CI, source maps are skipped to gain build speed
// For production, generate source maps for accurate stack traces without source code
// For development, generate "cheap" versions that can map to original line numbers
Expand Down Expand Up @@ -163,7 +163,6 @@ const createWebpackConfig = ({
},
},
output: {
module: latestBuild,
filename: ({ chunk }) =>
!isProdBuild || isStatsBuild || dontHash.has(chunk.name)
? "[name].js"
Expand Down Expand Up @@ -197,7 +196,7 @@ const createWebpackConfig = ({
: undefined,
},
experiments: {
outputModule: true,
topLevelAwait: true,
},
};
};
Expand Down
7 changes: 1 addition & 6 deletions test/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import webpack from "../build-scripts/webpack.cjs";

const config = webpack.createAppConfig({
export default webpack.createAppConfig({
isProdBuild: false,
latestBuild: true,
isStatsBuild: false,
isTestBuild: true,
});

// instant-mocha forces a CJS library, so cannot output ESM
config.output.module = false;

export default config;

0 comments on commit d914fb0

Please sign in to comment.