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 Jan 2, 2024
1 parent 97ede97 commit 8666ce4
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 3 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.10",
"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
187 changes: 184 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,29 @@ __metadata:
languageName: node
linkType: hard

"@babel/core@npm:^7.0.0":
version: 7.23.6
resolution: "@babel/core@npm:7.23.6"
dependencies:
"@ampproject/remapping": "npm:^2.2.0"
"@babel/code-frame": "npm:^7.23.5"
"@babel/generator": "npm:^7.23.6"
"@babel/helper-compilation-targets": "npm:^7.23.6"
"@babel/helper-module-transforms": "npm:^7.23.3"
"@babel/helpers": "npm:^7.23.6"
"@babel/parser": "npm:^7.23.6"
"@babel/template": "npm:^7.22.15"
"@babel/traverse": "npm:^7.23.6"
"@babel/types": "npm:^7.23.6"
convert-source-map: "npm:^2.0.0"
debug: "npm:^4.1.0"
gensync: "npm:^1.0.0-beta.2"
json5: "npm:^2.2.3"
semver: "npm:^6.3.1"
checksum: a72ba71d2f557d09ff58a5f0846344b9cea9dfcbd7418729a3a74d5b0f37a5ca024942fef4d19f248de751928a1be3d5cb0488746dd8896009dd55b974bb552e
languageName: node
linkType: hard

"@babel/generator@npm:^7.23.6":
version: 7.23.6
resolution: "@babel/generator@npm:7.23.6"
Expand Down Expand Up @@ -335,6 +358,17 @@ __metadata:
languageName: node
linkType: hard

"@babel/helpers@npm:^7.23.6":
version: 7.23.6
resolution: "@babel/helpers@npm:7.23.6"
dependencies:
"@babel/template": "npm:^7.22.15"
"@babel/traverse": "npm:^7.23.6"
"@babel/types": "npm:^7.23.6"
checksum: 2a85fd2bcbc15a6c94dbe7b9e94d8920f9de76d164179d6895fee89c4339079d9e3e56f572bf19b5e7d1e6f1997d7fbaeaa686b47d35136852631dfd09e85c2f
languageName: node
linkType: hard

"@babel/helpers@npm:^7.23.7":
version: 7.23.7
resolution: "@babel/helpers@npm:7.23.7"
Expand Down Expand Up @@ -390,6 +424,18 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:^7.23.3":
version: 7.23.3
resolution: "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:7.23.3"
dependencies:
"@babel/helper-environment-visitor": "npm:^7.22.20"
"@babel/helper-plugin-utils": "npm:^7.22.5"
peerDependencies:
"@babel/core": ^7.0.0
checksum: 6e13f14949eb943d33cf4d3775a7195fa93c92851dfb648931038e9eb92a9b1709fdaa5a0ff6cf063cfcd68b3e52d280f3ebc0f3085b3e006e64dd6196ecb72a
languageName: node
linkType: hard

"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:^7.23.7":
version: 7.23.7
resolution: "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@npm:7.23.7"
Expand Down Expand Up @@ -667,6 +713,20 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-transform-async-generator-functions@npm:^7.23.4":
version: 7.23.4
resolution: "@babel/plugin-transform-async-generator-functions@npm:7.23.4"
dependencies:
"@babel/helper-environment-visitor": "npm:^7.22.20"
"@babel/helper-plugin-utils": "npm:^7.22.5"
"@babel/helper-remap-async-to-generator": "npm:^7.22.20"
"@babel/plugin-syntax-async-generators": "npm:^7.8.4"
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: e2fc132c9033711d55209f4781e1fc73f0f4da5e0ca80a2da73dec805166b73c92a6e83571a8994cd2c893a28302e24107e90856202b24781bab734f800102bb
languageName: node
linkType: hard

"@babel/plugin-transform-async-generator-functions@npm:^7.23.7":
version: 7.23.7
resolution: "@babel/plugin-transform-async-generator-functions@npm:7.23.7"
Expand Down Expand Up @@ -1357,6 +1417,96 @@ __metadata:
languageName: node
linkType: hard

"@babel/preset-env@npm:^7.0.0":
version: 7.23.6
resolution: "@babel/preset-env@npm:7.23.6"
dependencies:
"@babel/compat-data": "npm:^7.23.5"
"@babel/helper-compilation-targets": "npm:^7.23.6"
"@babel/helper-plugin-utils": "npm:^7.22.5"
"@babel/helper-validator-option": "npm:^7.23.5"
"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "npm:^7.23.3"
"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "npm:^7.23.3"
"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "npm:^7.23.3"
"@babel/plugin-proposal-private-property-in-object": "npm:7.21.0-placeholder-for-preset-env.2"
"@babel/plugin-syntax-async-generators": "npm:^7.8.4"
"@babel/plugin-syntax-class-properties": "npm:^7.12.13"
"@babel/plugin-syntax-class-static-block": "npm:^7.14.5"
"@babel/plugin-syntax-dynamic-import": "npm:^7.8.3"
"@babel/plugin-syntax-export-namespace-from": "npm:^7.8.3"
"@babel/plugin-syntax-import-assertions": "npm:^7.23.3"
"@babel/plugin-syntax-import-attributes": "npm:^7.23.3"
"@babel/plugin-syntax-import-meta": "npm:^7.10.4"
"@babel/plugin-syntax-json-strings": "npm:^7.8.3"
"@babel/plugin-syntax-logical-assignment-operators": "npm:^7.10.4"
"@babel/plugin-syntax-nullish-coalescing-operator": "npm:^7.8.3"
"@babel/plugin-syntax-numeric-separator": "npm:^7.10.4"
"@babel/plugin-syntax-object-rest-spread": "npm:^7.8.3"
"@babel/plugin-syntax-optional-catch-binding": "npm:^7.8.3"
"@babel/plugin-syntax-optional-chaining": "npm:^7.8.3"
"@babel/plugin-syntax-private-property-in-object": "npm:^7.14.5"
"@babel/plugin-syntax-top-level-await": "npm:^7.14.5"
"@babel/plugin-syntax-unicode-sets-regex": "npm:^7.18.6"
"@babel/plugin-transform-arrow-functions": "npm:^7.23.3"
"@babel/plugin-transform-async-generator-functions": "npm:^7.23.4"
"@babel/plugin-transform-async-to-generator": "npm:^7.23.3"
"@babel/plugin-transform-block-scoped-functions": "npm:^7.23.3"
"@babel/plugin-transform-block-scoping": "npm:^7.23.4"
"@babel/plugin-transform-class-properties": "npm:^7.23.3"
"@babel/plugin-transform-class-static-block": "npm:^7.23.4"
"@babel/plugin-transform-classes": "npm:^7.23.5"
"@babel/plugin-transform-computed-properties": "npm:^7.23.3"
"@babel/plugin-transform-destructuring": "npm:^7.23.3"
"@babel/plugin-transform-dotall-regex": "npm:^7.23.3"
"@babel/plugin-transform-duplicate-keys": "npm:^7.23.3"
"@babel/plugin-transform-dynamic-import": "npm:^7.23.4"
"@babel/plugin-transform-exponentiation-operator": "npm:^7.23.3"
"@babel/plugin-transform-export-namespace-from": "npm:^7.23.4"
"@babel/plugin-transform-for-of": "npm:^7.23.6"
"@babel/plugin-transform-function-name": "npm:^7.23.3"
"@babel/plugin-transform-json-strings": "npm:^7.23.4"
"@babel/plugin-transform-literals": "npm:^7.23.3"
"@babel/plugin-transform-logical-assignment-operators": "npm:^7.23.4"
"@babel/plugin-transform-member-expression-literals": "npm:^7.23.3"
"@babel/plugin-transform-modules-amd": "npm:^7.23.3"
"@babel/plugin-transform-modules-commonjs": "npm:^7.23.3"
"@babel/plugin-transform-modules-systemjs": "npm:^7.23.3"
"@babel/plugin-transform-modules-umd": "npm:^7.23.3"
"@babel/plugin-transform-named-capturing-groups-regex": "npm:^7.22.5"
"@babel/plugin-transform-new-target": "npm:^7.23.3"
"@babel/plugin-transform-nullish-coalescing-operator": "npm:^7.23.4"
"@babel/plugin-transform-numeric-separator": "npm:^7.23.4"
"@babel/plugin-transform-object-rest-spread": "npm:^7.23.4"
"@babel/plugin-transform-object-super": "npm:^7.23.3"
"@babel/plugin-transform-optional-catch-binding": "npm:^7.23.4"
"@babel/plugin-transform-optional-chaining": "npm:^7.23.4"
"@babel/plugin-transform-parameters": "npm:^7.23.3"
"@babel/plugin-transform-private-methods": "npm:^7.23.3"
"@babel/plugin-transform-private-property-in-object": "npm:^7.23.4"
"@babel/plugin-transform-property-literals": "npm:^7.23.3"
"@babel/plugin-transform-regenerator": "npm:^7.23.3"
"@babel/plugin-transform-reserved-words": "npm:^7.23.3"
"@babel/plugin-transform-shorthand-properties": "npm:^7.23.3"
"@babel/plugin-transform-spread": "npm:^7.23.3"
"@babel/plugin-transform-sticky-regex": "npm:^7.23.3"
"@babel/plugin-transform-template-literals": "npm:^7.23.3"
"@babel/plugin-transform-typeof-symbol": "npm:^7.23.3"
"@babel/plugin-transform-unicode-escapes": "npm:^7.23.3"
"@babel/plugin-transform-unicode-property-regex": "npm:^7.23.3"
"@babel/plugin-transform-unicode-regex": "npm:^7.23.3"
"@babel/plugin-transform-unicode-sets-regex": "npm:^7.23.3"
"@babel/preset-modules": "npm:0.1.6-no-external-plugins"
babel-plugin-polyfill-corejs2: "npm:^0.4.6"
babel-plugin-polyfill-corejs3: "npm:^0.8.5"
babel-plugin-polyfill-regenerator: "npm:^0.5.3"
core-js-compat: "npm:^3.31.0"
semver: "npm:^6.3.1"
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: b47e9e7cdb0d31b2a6919ffb1b767f8159a69b000e257c1dad1121dea8c42d7ec12a892a691d1a8e90cde86edd41b017254574ec6b82a984013bb3c9e3df2b36
languageName: node
linkType: hard

"@babel/preset-modules@npm:0.1.6-no-external-plugins":
version: 0.1.6-no-external-plugins
resolution: "@babel/preset-modules@npm:0.1.6-no-external-plugins"
Expand Down Expand Up @@ -1412,6 +1562,24 @@ __metadata:
languageName: node
linkType: hard

"@babel/traverse@npm:^7.23.6":
version: 7.23.6
resolution: "@babel/traverse@npm:7.23.6"
dependencies:
"@babel/code-frame": "npm:^7.23.5"
"@babel/generator": "npm:^7.23.6"
"@babel/helper-environment-visitor": "npm:^7.22.20"
"@babel/helper-function-name": "npm:^7.23.0"
"@babel/helper-hoist-variables": "npm:^7.22.5"
"@babel/helper-split-export-declaration": "npm:^7.22.6"
"@babel/parser": "npm:^7.23.6"
"@babel/types": "npm:^7.23.6"
debug: "npm:^4.3.1"
globals: "npm:^11.1.0"
checksum: ee4434a3ce792ee8956b64d76843caa1dda4779bb621ed9f951dd3551965bf1f292f097011c9730ecbc0b57f02434b1fa5a771610a2ef570726b0df0fc3332d9
languageName: node
linkType: hard

"@babel/traverse@npm:^7.23.7":
version: 7.23.7
resolution: "@babel/traverse@npm:7.23.7"
Expand Down Expand Up @@ -6000,7 +6168,7 @@ __metadata:
languageName: node
linkType: hard

"babel-plugin-polyfill-corejs2@npm:^0.4.7":
"babel-plugin-polyfill-corejs2@npm:^0.4.6, babel-plugin-polyfill-corejs2@npm:^0.4.7":
version: 0.4.7
resolution: "babel-plugin-polyfill-corejs2@npm:0.4.7"
dependencies:
Expand All @@ -6013,7 +6181,7 @@ __metadata:
languageName: node
linkType: hard

"babel-plugin-polyfill-corejs3@npm:^0.8.7":
"babel-plugin-polyfill-corejs3@npm:^0.8.5, babel-plugin-polyfill-corejs3@npm:^0.8.7":
version: 0.8.7
resolution: "babel-plugin-polyfill-corejs3@npm:0.8.7"
dependencies:
Expand All @@ -6025,7 +6193,7 @@ __metadata:
languageName: node
linkType: hard

"babel-plugin-polyfill-regenerator@npm:^0.5.4":
"babel-plugin-polyfill-regenerator@npm:^0.5.3, babel-plugin-polyfill-regenerator@npm:^0.5.4":
version: 0.5.4
resolution: "babel-plugin-polyfill-regenerator@npm:0.5.4"
dependencies:
Expand Down Expand Up @@ -9704,6 +9872,7 @@ __metadata:
tar: "npm:6.2.0"
terser-webpack-plugin: "npm:5.3.10"
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 @@ -15240,6 +15409,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 8666ce4

Please sign in to comment.