File tree 2 files changed +10
-7
lines changed
packages/next/src/server/typescript
2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -87,13 +87,13 @@ function updateVirtualFileWithType(
87
87
TYPE_IMPORT
88
88
89
89
if ( virtualTsEnv . sys . fileExists ( fileName ) ) {
90
- log ( '[next] Updating file: ' + fileName )
90
+ log ( 'Updating file: ' + fileName )
91
91
// FIXME: updateFile() breaks as the file doesn't exists, which is weird.
92
92
// virtualTsEnv.updateFile(fileName, newSource)
93
93
virtualTsEnv . deleteFile ( fileName )
94
94
virtualTsEnv . createFile ( fileName , newSource )
95
95
} else {
96
- log ( '[next] Creating file: ' + fileName )
96
+ log ( 'Creating file: ' + fileName )
97
97
virtualTsEnv . createFile ( fileName , newSource )
98
98
}
99
99
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ let appDirRegExp: RegExp
16
16
export let virtualTsEnv : VirtualTypeScriptEnvironment
17
17
18
18
export function log ( message : string ) {
19
- info . project . projectService . logger . info ( message )
19
+ info . project . projectService . logger . info ( '[next] ' + message )
20
20
}
21
21
22
22
// This function has to be called initially.
@@ -31,7 +31,7 @@ export function init(opts: {
31
31
'^' + ( projectDir + '(/src)?/app' ) . replace ( / [ \\ / ] / g, '[\\/]' )
32
32
)
33
33
34
- log ( '[next] Initializing Next.js TypeScript plugin: ' + projectDir )
34
+ log ( 'Initializing Next.js TypeScript plugin: ' + projectDir )
35
35
36
36
const compilerOptions = info . project . getCompilerOptions ( )
37
37
const fsMap = createDefaultMapFromNodeModules (
@@ -48,11 +48,14 @@ export function init(opts: {
48
48
compilerOptions
49
49
)
50
50
51
- if ( ! virtualTsEnv ) {
52
- throw new Error ( '[next] Failed to create virtual TypeScript environment.' )
51
+ if ( virtualTsEnv ) {
52
+ log (
53
+ 'Failed to create virtual TypeScript environment. This is a bug in Next.js TypeScript plugin. Please report it by opening an issue at https://github.com/vercel/next.js/issues.'
54
+ )
55
+ return
53
56
}
54
57
55
- log ( '[next] Successfully initialized Next.js TypeScript plugin!' )
58
+ log ( 'Successfully initialized Next.js TypeScript plugin!' )
56
59
}
57
60
58
61
export function getTs ( ) {
You can’t perform that action at this time.
0 commit comments