Skip to content

Commit

Permalink
Optimise Webpack configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz authored and FrederikBolding committed Aug 23, 2024
1 parent cf9c387 commit 0f460bd
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 590 deletions.
2 changes: 0 additions & 2 deletions packages/snaps-execution-environments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"babel-plugin-tsconfig-paths-module-resolver": "^1.0.4",
"babelify": "^10.0.0",
"browserify": "^17.0.0",
"crypto-browserify": "^3.12.0",
"deepmerge": "^4.2.2",
"depcheck": "^1.4.7",
"esbuild": "^0.18.10",
Expand Down Expand Up @@ -130,7 +129,6 @@
"ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"tsup": "^8.0.1",
"tty-browserify": "^0.0.1",
"typescript": "~5.0.4",
"vite": "^4.3.9",
"vite-tsconfig-paths": "^4.0.5",
Expand Down
22 changes: 14 additions & 8 deletions packages/snaps-execution-environments/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,34 @@ const baseConfig: Configuration = {
loader: 'swc-loader',
options: {
...swc,
module: {
type: 'es6',
},
},
},
},
{
test: /\.m?js$/u,
resolve: {
// Fixes an issue with `@metamask/key-tree`. We can remove this after
// releasing a new version of `@metamask/key-tree`.
fullySpecified: false,
},
},
],
},
resolve: {
mainFields: ['module', 'main'],
extensions: ['.ts', '.js'],
plugins: [
new TsconfigPathsPlugin({
mainFields: ['module', 'main'],
}),
],
plugins: [new TsconfigPathsPlugin()],
fallback: {
// eslint-disable-next-line @typescript-eslint/naming-convention
child_process: false,
crypto: require.resolve('crypto-browserify'),
crypto: false,
fs: false,
os: false,
path: false,
stream: require.resolve('stream-browserify'),
tty: require.resolve('tty-browserify'),
tty: false,
// eslint-disable-next-line @typescript-eslint/naming-convention
worker_threads: false,
},
Expand Down
Loading

0 comments on commit 0f460bd

Please sign in to comment.