Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix issues with declarations and eval worker
  • Loading branch information
Mrtenz committed Sep 9, 2024
commit f51eccd693e9597f86ef402b40b55c906cd3792f
4 changes: 3 additions & 1 deletion packages/examples/packages/images/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"baseUrl": "./",
"paths": {
"@metamask/*": ["../../../*/src"]
}
},
"module": "ES2020",
"moduleResolution": "Node10"
Comment on lines +8 to +9
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snaps-sdk has a .ts file which declares *.svg, *.png, etc., but this doesn't work in Node16 or NodeNext module resolution. I've kept snaps-sdk and the image example at Node10 for now, to not introduce any breaking changes.

},
"include": ["src", "snap.config.ts"],
"references": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
// eslint-disable-next-line import/unambiguous
declare module '*.svg' {
const content: string;
export default content;
}

declare module '*.png' {
const content: string;
export default content;
}

declare module '*.svg' {
declare module '*.jpg' {
const content: string;
export default content;
}
1 change: 1 addition & 0 deletions packages/snaps-sdk/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This is intentionally imported, rather than re-exported.
/* eslint-disable import/no-unassigned-import */
import './global';
import './images';
/* eslint-enable import/no-unassigned-import */

export * from './caip';
Expand Down
4 changes: 3 additions & 1 deletion packages/snaps-sdk/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist",
"rootDir": "./src"
"rootDir": "./src",
"module": "ES2020",
"moduleResolution": "Node10"
},
"include": ["./src"],
"exclude": [
Expand Down
4 changes: 3 additions & 1 deletion packages/snaps-sdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"compilerOptions": {
"baseUrl": "./",
"jsx": "react-jsx",
"jsxImportSource": "@metamask/snaps-sdk"
"jsxImportSource": "@metamask/snaps-sdk",
"module": "ES2020",
"moduleResolution": "Node10"
Comment on lines +7 to +8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snaps-sdk has a .ts file which declares *.svg, *.png, etc., but this doesn't work in Node16 or NodeNext module resolution. I've kept snaps-sdk and the image example at Node10 for now, to not introduce any breaking changes.

},
"include": [
"./src",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-utils/src/eval-worker.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('ts-node').register({
transpileOnly: true,
compilerOptions: {
module: 'commonjs',
module: 'Node16',
}
});

Expand Down