Skip to content

Commit

Permalink
Add Webpack plugin to transform async modules
Browse files Browse the repository at this point in the history
  • Loading branch information
steverep committed Dec 31, 2023
1 parent bd04215 commit 9de6ac0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
5 changes: 5 additions & 0 deletions build-scripts/webpack.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const TerserPlugin = require("terser-webpack-plugin");
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
const log = require("fancy-log");
const WebpackBar = require("webpackbar");
const {
TransformAsyncModulesPlugin,
} = require("transform-async-modules-webpack-plugin");
const paths = require("./paths.cjs");
const bundle = require("./bundle.cjs");

Expand Down Expand Up @@ -152,6 +155,8 @@ const createWebpackConfig = ({
stats: { assets: true, chunks: true, modules: true },
transform: (stats) => JSON.stringify(filterStats(stats)),
}),
!latestBuild &&
new TransformAsyncModulesPlugin({ browserslistEnv: "legacy" }),
].filter(Boolean),
resolve: {
extensions: [".ts", ".js", ".json"],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@
"systemjs": "6.14.2",
"tar": "6.2.0",
"terser-webpack-plugin": "5.3.9",
"transform-async-modules-webpack-plugin": "1.0.2",
"ts-lit-plugin": "2.0.1",
"typescript": "5.3.3",
"vinyl-buffer": "1.0.1",
Expand Down
17 changes: 15 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/core@npm:7.23.6, @babel/core@npm:^7.11.1, @babel/core@npm:^7.12.3":
"@babel/core@npm:7.23.6, @babel/core@npm:^7.0.0, @babel/core@npm:^7.11.1, @babel/core@npm:^7.12.3":
version: 7.23.6
resolution: "@babel/core@npm:7.23.6"
dependencies:
Expand Down Expand Up @@ -1270,7 +1270,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/preset-env@npm:7.23.6, @babel/preset-env@npm:^7.11.0":
"@babel/preset-env@npm:7.23.6, @babel/preset-env@npm:^7.0.0, @babel/preset-env@npm:^7.11.0":
version: 7.23.6
resolution: "@babel/preset-env@npm:7.23.6"
dependencies:
Expand Down Expand Up @@ -9713,6 +9713,7 @@ __metadata:
tar: "npm:6.2.0"
terser-webpack-plugin: "npm:5.3.9"
tinykeys: "npm:2.1.0"
transform-async-modules-webpack-plugin: "npm:1.0.2"
ts-lit-plugin: "npm:2.0.1"
tsparticles-engine: "npm:2.12.0"
tsparticles-preset-links: "npm:2.12.0"
Expand Down Expand Up @@ -15249,6 +15250,18 @@ __metadata:
languageName: node
linkType: hard

"transform-async-modules-webpack-plugin@npm:1.0.2":
version: 1.0.2
resolution: "transform-async-modules-webpack-plugin@npm:1.0.2"
dependencies:
"@babel/core": "npm:^7.0.0"
"@babel/preset-env": "npm:^7.0.0"
peerDependencies:
webpack: ^5.0.0
checksum: 645df77c31e42f8ae57d86dfa023f67e4a3854f3b0848a9fd28392cb83d91fc05762150b909d01ad570e867b9e16e7e49c88a183d2dc7911d0e0154aaac21d52
languageName: node
linkType: hard

"ts-api-utils@npm:^1.0.1":
version: 1.0.3
resolution: "ts-api-utils@npm:1.0.3"
Expand Down

0 comments on commit 9de6ac0

Please sign in to comment.