diff --git a/packages/examples/packages/bip32/snap.manifest.json b/packages/examples/packages/bip32/snap.manifest.json index 4431d756a4..74b53878c3 100644 --- a/packages/examples/packages/bip32/snap.manifest.json +++ b/packages/examples/packages/bip32/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "ZjO2/vyI+gsEEsIWrloT+RXRpDiu90IJh8zk/geewkw=", + "shasum": "ALkwbuS0MFVTbJB0zQXPRdDmyis8TAfZayoVY0dDAow=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/bip44/snap.manifest.json b/packages/examples/packages/bip44/snap.manifest.json index cc21d25208..1307a21c4e 100644 --- a/packages/examples/packages/bip44/snap.manifest.json +++ b/packages/examples/packages/bip44/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "JfQKetc6BTHCZdqd2yeKoJZvMG3qq51ATyr1B3A2Ni8=", + "shasum": "ivu8DqblrnqDucyKZQRFKcsT6uc7Vw+DsQJRJgIXn9Y=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/client-status/snap.manifest.json b/packages/examples/packages/client-status/snap.manifest.json index e5878a39d3..0f5996ea9b 100644 --- a/packages/examples/packages/client-status/snap.manifest.json +++ b/packages/examples/packages/client-status/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "yWT12MR3BSCI14HKXyFQGp6RhG9s1hMgIRZiJCARYkc=", + "shasum": "nJN72lSBRDfROObGpijTtKtZjRSoWSTgbdo6/CScl1I=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/cronjobs/snap.manifest.json b/packages/examples/packages/cronjobs/snap.manifest.json index ffc26899a3..7526eb2376 100644 --- a/packages/examples/packages/cronjobs/snap.manifest.json +++ b/packages/examples/packages/cronjobs/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "IiaQ+vlnHF0JYKKVGd4/kMG+T50Dm7lCcrw2sDKftfQ=", + "shasum": "xBvDzo5oiGIbKEVGmzlI39BCzvh/l/nNkkAcOABQqoo=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/dialogs/snap.manifest.json b/packages/examples/packages/dialogs/snap.manifest.json index 0906fbfae7..7a30a04e3a 100644 --- a/packages/examples/packages/dialogs/snap.manifest.json +++ b/packages/examples/packages/dialogs/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "uaVAErOHm4rPbUun4eo9xOmObQ2I20rF2IX7BRU57LA=", + "shasum": "wFgSmNho6eVxo+nEE2XlWRFVR8tLqKghhh86ozrwmAg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/errors/snap.manifest.json b/packages/examples/packages/errors/snap.manifest.json index aadfa42262..8c5305f1d4 100644 --- a/packages/examples/packages/errors/snap.manifest.json +++ b/packages/examples/packages/errors/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "yHYVhtnHm6SonjnHmOYISrwKrySimS7p+jOISJsIi90=", + "shasum": "sAk9LVkXo2OI3rnOT+3/RToWgk5xT4IfJ0BJiQbbYjw=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/ethereum-provider/snap.manifest.json b/packages/examples/packages/ethereum-provider/snap.manifest.json index 5a929db7ee..08090ed68e 100644 --- a/packages/examples/packages/ethereum-provider/snap.manifest.json +++ b/packages/examples/packages/ethereum-provider/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "TU/R5DuCBfqVbdyRuyJztDjIYzupiVlijD5xvcuOZiU=", + "shasum": "m4jFP39tZIR1XMosUJ3u8YIfepiI9aRIMna3Hg8RlQQ=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/ethers-js/snap.manifest.json b/packages/examples/packages/ethers-js/snap.manifest.json index c24deb2d9e..bb39f17e23 100644 --- a/packages/examples/packages/ethers-js/snap.manifest.json +++ b/packages/examples/packages/ethers-js/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "R6jyQ9MImF2Khms/DjvO8McPmjZAeUej2jbY8XOC49s=", + "shasum": "t9CVxyl+WB6UwtynS8zhgA76KWUmQUdGGP+E0Rj+fR0=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/get-entropy/snap.manifest.json b/packages/examples/packages/get-entropy/snap.manifest.json index 01c09ef14d..723f267458 100644 --- a/packages/examples/packages/get-entropy/snap.manifest.json +++ b/packages/examples/packages/get-entropy/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "nB2XTMy/AC2QW5WWk2xL7Ed//hf/4IeSTdDIBtPZgSs=", + "shasum": "BLq144YW0hKG00k8SN3+7F9rKy6hggZVjjx9WkraNEI=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/get-file/snap.manifest.json b/packages/examples/packages/get-file/snap.manifest.json index 59e19e0a41..6c7b043a0d 100644 --- a/packages/examples/packages/get-file/snap.manifest.json +++ b/packages/examples/packages/get-file/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "vX3F2cUxbpH1b7HmBcqpp6h23iUWW7uwHR8lEmmKqL8=", + "shasum": "20Z28B/48X1gTo6V+RSFpx0BNs13lMwD8FE+NiDn18o=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/home-page/snap.manifest.json b/packages/examples/packages/home-page/snap.manifest.json index be09c47685..90f5cdbb81 100644 --- a/packages/examples/packages/home-page/snap.manifest.json +++ b/packages/examples/packages/home-page/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "rVaZdPjQO1y/11Oc54ud6nBId560CQZlUplvgWenQjI=", + "shasum": "rZXPzEYUFk5k8lG85JaR11U4wombdIZ8xM3go7dyhhg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/images/snap.manifest.json b/packages/examples/packages/images/snap.manifest.json index 0d52d9ee0e..2bc5eadc61 100644 --- a/packages/examples/packages/images/snap.manifest.json +++ b/packages/examples/packages/images/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "B9CP2TEbrD65sHO4WgdT6etbwwe9HVMG/EZE41Gclmk=", + "shasum": "YRGwMaOJHIRegfuR/LmMR+fs2pOi3Wg31Fh3Y/lOJfk=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/invoke-snap/packages/consumer-signer/snap.manifest.json b/packages/examples/packages/invoke-snap/packages/consumer-signer/snap.manifest.json index bf98cee449..193686d359 100644 --- a/packages/examples/packages/invoke-snap/packages/consumer-signer/snap.manifest.json +++ b/packages/examples/packages/invoke-snap/packages/consumer-signer/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "eYnviy8NIYFFoq8LpNKK59QOB+dD43swieNvMTA4Vrc=", + "shasum": "Zul7ybCncDcgpTUpQNx0iTTvy97JNd0TIzM9QpzVROc=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json b/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json index b229b9259e..3798234941 100644 --- a/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json +++ b/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "nK1EKaUCdvw9Wq636V5wqYNtAle6tmuro090rO+YxLI=", + "shasum": "RVmSqvKdYxv4Ws0cCtkepbmXnQ+6Wj0pJ+/NR0WhqiI=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/json-rpc/snap.manifest.json b/packages/examples/packages/json-rpc/snap.manifest.json index 25c1ed29b0..49bd46e941 100644 --- a/packages/examples/packages/json-rpc/snap.manifest.json +++ b/packages/examples/packages/json-rpc/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "GvvGS+PSG/6uFDd7XBT3ZI7qsG+LE+rBoqOoVmB1Kq4=", + "shasum": "CF4xhZoqnfJt0pjTffWtNKNr8k4YDXh9ZuaszgPvoUU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/lifecycle-hooks/snap.manifest.json b/packages/examples/packages/lifecycle-hooks/snap.manifest.json index 017049ef70..f870f6c4ef 100644 --- a/packages/examples/packages/lifecycle-hooks/snap.manifest.json +++ b/packages/examples/packages/lifecycle-hooks/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "8cgeiYi2GUhPWmOqquWCiadJPTbSLqo5LDUpAKLbUHA=", + "shasum": "tKAO/jlBp3BZubiu2HrD1idkHDIRPh7sAhOw+7htEN4=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/localization/snap.manifest.json b/packages/examples/packages/localization/snap.manifest.json index b030cb9452..b27498d25f 100644 --- a/packages/examples/packages/localization/snap.manifest.json +++ b/packages/examples/packages/localization/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "pmtVK15TtC9vdrx/Tt+m6cipNVWcN4YrgXS4yl5YI3s=", + "shasum": "1ag+BcW+rfL1qTmpnMA+Sd0h57/sZoprFB4qMFXBmPE=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/manage-state/snap.manifest.json b/packages/examples/packages/manage-state/snap.manifest.json index 678eb81fb1..f9c3625fff 100644 --- a/packages/examples/packages/manage-state/snap.manifest.json +++ b/packages/examples/packages/manage-state/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "lqyeAE0sgCDYiga8uhb/2n7P8X2fEy8K32zTiFE2uv0=", + "shasum": "GFuYJnitc0nYDwAD8jhGyCw/Ufc5Ai9RbJbFWpydlFM=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/name-lookup/snap.manifest.json b/packages/examples/packages/name-lookup/snap.manifest.json index 3194204b0f..a9e2cd531b 100644 --- a/packages/examples/packages/name-lookup/snap.manifest.json +++ b/packages/examples/packages/name-lookup/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "snZ/j7c61yFp0K0b77HAw0cLdQswUuqoJE+nVrrBK/A=", + "shasum": "ATVuf+9AUmlx48Lw3rcMQia6bf4UBg/M1SXL8FdG8t8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/network-access/snap.manifest.json b/packages/examples/packages/network-access/snap.manifest.json index 4075deb008..7facdbcd14 100644 --- a/packages/examples/packages/network-access/snap.manifest.json +++ b/packages/examples/packages/network-access/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "vUmPNRf1Bbf0MFTUDqrTv14PPpLqBnGQBiiEV3liNlI=", + "shasum": "7TGnfMZy7JaBMNhA62f6lmXWojpzMVSuSkxaKqfyPw0=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/notifications/snap.manifest.json b/packages/examples/packages/notifications/snap.manifest.json index 7871dcb20b..65a1ace6a4 100644 --- a/packages/examples/packages/notifications/snap.manifest.json +++ b/packages/examples/packages/notifications/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "rXsyOrPqMBib+UpRgLzZbVtWpZdlLxv4ohvaa+WbSvs=", + "shasum": "QxqKMFGyTlsrrf7nDj/JlbQHDIF2l+eO2E5TttzMS64=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/signature-insights/snap.manifest.json b/packages/examples/packages/signature-insights/snap.manifest.json index 9e8f597c16..dce3c9e48b 100644 --- a/packages/examples/packages/signature-insights/snap.manifest.json +++ b/packages/examples/packages/signature-insights/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "9/UzYulP10qM9PJ5Xc/bCgMEO6u6oX4GEkDzIjOPq/k=", + "shasum": "Rt8Li02ub7KWGSrpOkrf+P+mSZEYyUsLCQAln3LhYB0=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/transaction-insights/snap.manifest.json b/packages/examples/packages/transaction-insights/snap.manifest.json index bd30b27bb5..d2d2ead2f5 100644 --- a/packages/examples/packages/transaction-insights/snap.manifest.json +++ b/packages/examples/packages/transaction-insights/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "hGq7EXkTWXrWuOOJrrlzshFjsKZZh91z5SOw+pmnYJg=", + "shasum": "s1ibpWtsuA2ku7WoMzpBHBFH+qQ1b2DI7as9fGPjDBY=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/wasm/snap.manifest.json b/packages/examples/packages/wasm/snap.manifest.json index 861cac9a87..142ae51ddb 100644 --- a/packages/examples/packages/wasm/snap.manifest.json +++ b/packages/examples/packages/wasm/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "ZEfAOxy5Lid72lpfSfNeAY+68Fc3fVB8bNhYYCDLDng=", + "shasum": "eQZoypi/2K6+BnPVvcwOp3I8uwLKzbzLtAahPHVjOY0=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snaps-cli/src/webpack/__snapshots__/config.test.ts.snap b/packages/snaps-cli/src/webpack/__snapshots__/config.test.ts.snap index af911671ca..03cbd6e87b 100644 --- a/packages/snaps-cli/src/webpack/__snapshots__/config.test.ts.snap +++ b/packages/snaps-cli/src/webpack/__snapshots__/config.test.ts.snap @@ -12,7 +12,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -25,7 +25,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -121,6 +121,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -154,7 +156,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -167,7 +169,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -263,6 +265,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -296,7 +300,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -309,7 +313,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": true, "sync": false, @@ -405,6 +409,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -438,7 +444,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -451,7 +457,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": true, "sync": false, @@ -544,6 +550,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -572,7 +580,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -585,7 +593,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -686,6 +694,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -719,7 +729,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -732,7 +742,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -828,6 +838,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -861,7 +873,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -874,7 +886,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -970,6 +982,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -1003,7 +1017,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -1016,7 +1030,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -1120,6 +1134,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -1153,7 +1169,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -1166,7 +1182,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -1270,6 +1286,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -1303,7 +1321,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -1316,7 +1334,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -1421,6 +1439,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -1454,7 +1474,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -1467,7 +1487,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -1563,6 +1583,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -1596,7 +1618,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -1609,7 +1631,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -1705,6 +1727,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -1738,7 +1762,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -1751,7 +1775,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -1856,6 +1880,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -1889,7 +1915,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/node_modules/swc-loader/index.js", "options": { @@ -1902,7 +1928,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t }, }, "module": { - "type": "commonjs", + "type": "es6", }, "sourceMaps": false, "sync": false, @@ -2007,6 +2033,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -2040,7 +2068,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/loaders/browserify", "options": { @@ -2147,6 +2175,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -2175,7 +2205,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/loaders/browserify", "options": { @@ -2282,6 +2312,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { @@ -2310,7 +2342,7 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "rules": [ { "exclude": /node_modules/u, - "test": /\\\\\\.\\[tj\\]sx\\?\\$/u, + "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { "loader": "/foo/bar/loaders/browserify", "options": { @@ -2417,6 +2449,8 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "resolve": { "extensions": [ ".js", + ".mjs", + ".cjs", ".ts", ], "fallback": { diff --git a/packages/snaps-cli/src/webpack/config.ts b/packages/snaps-cli/src/webpack/config.ts index af693c0558..1aaebe4dce 100644 --- a/packages/snaps-cli/src/webpack/config.ts +++ b/packages/snaps-cli/src/webpack/config.ts @@ -185,7 +185,7 @@ export async function getDefaultConfiguration( module: { rules: [ { - test: /\.[tj]sx?$/u, + test: /\.(js|mjs|cjs|ts)$/u, exclude: /node_modules/u, use: await getDefaultLoader(config), }, @@ -220,10 +220,10 @@ export async function getDefaultConfiguration( */ resolve: { /** - * The extensions to resolve. We set it to resolve `.js` and `.ts` + * The extensions to resolve. We set it to resolve `.(c|m)?js` and `.ts` * files. */ - extensions: ['.js', '.ts'], + extensions: ['.js', '.mjs', '.cjs', '.ts'], /** * The fallback options. This tells Webpack how to handle imports that diff --git a/packages/snaps-cli/src/webpack/utils.ts b/packages/snaps-cli/src/webpack/utils.ts index 74283ef631..75900e158f 100644 --- a/packages/snaps-cli/src/webpack/utils.ts +++ b/packages/snaps-cli/src/webpack/utils.ts @@ -136,12 +136,14 @@ export async function getDefaultLoader({ */ module: { /** - * This tells SWC to output CommonJS modules. MetaMask Snaps - * doesn't support ES modules yet, so this is necessary. + * This tells SWC to output ES6 modules. This will allow Webpack to + * optimize the output code better. Snaps don't support ES6 however, so + * the output code will be transpiled to CommonJS by Webpack later in + * the build process. * - * @see https://swc.rs/docs/configuration/modules#commonjs + * @see https://swc.rs/docs/configuration/modules#es6 */ - type: 'commonjs', + type: 'es6', }, env: {