File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
src/utils/conditional-imports Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,13 @@ const require = createRequire(import.meta.url);
8
8
9
9
export default ( typescript === undefined
10
10
? undefined
11
- : require ( "ts-api-utils" ) ) as typeof tsApiUtils | undefined ;
11
+ : ( ( ) => {
12
+ try {
13
+ return require ( "ts-api-utils" ) ;
14
+ } catch {
15
+ return undefined ;
16
+ }
17
+ } ) ( ) ) as typeof tsApiUtils | undefined ;
12
18
13
19
// export default (await (() => {
14
20
// if (ts !== undefined) {
Original file line number Diff line number Diff line change @@ -4,7 +4,13 @@ import type typescript from "typescript";
4
4
5
5
const require = createRequire ( import . meta. url ) ;
6
6
7
- export default require ( "typescript" ) as typeof typescript | undefined ;
7
+ export default ( ( ) => {
8
+ try {
9
+ return require ( "typescript" ) ;
10
+ } catch {
11
+ return undefined ;
12
+ }
13
+ } ) ( ) as typeof typescript | undefined ;
8
14
9
15
// export default (await import("typescript")
10
16
// .then((r) => r.default)
You can’t perform that action at this time.
0 commit comments