[next-config-ts] Set Node.js native TS loader fallback flag to process.env (#83832)
Since local variables aren't passed to the workers, the fallback flag
wasn't passed correctly. Since `process.env` is passed, use that to set
the flag.
#### Before
```
running pnpm next build
⚠ Failed to import "next.config.ts" using Node.js native TypeScript resolution. Falling back to legacy resolution. {
cause: TypeError: Module "file:///private/var/folders/cm/328vyfy92k194zkm0jpl5sqw0000gn/T/next-install-0b4875510d429ddf1727b03e3cbba84cb61013dfee0914f9812b7608c029a47f/foo.json" needs an import attribute of "type: json"
at ignore-listed frames {
code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
}
}
Creating an optimized production build ...
⚠ Failed to import "next.config.ts" using Node.js native TypeScript resolution. Falling back to legacy resolution. {
cause: TypeError: Module "file:///private/var/folders/cm/328vyfy92k194zkm0jpl5sqw0000gn/T/next-install-0b4875510d429ddf1727b03e3cbba84cb61013dfee0914f9812b7608c029a47f/foo.json" needs an import attribute of "type: json"
at ignore-listed frames {
code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
}
}
⚠ Failed to import "next.config.ts" using Node.js native TypeScript resolution. Falling back to legacy resolution. {
cause: TypeError: Module "file:///private/var/folders/cm/328vyfy92k194zkm0jpl5sqw0000gn/T/next-install-0b4875510d429ddf1727b03e3cbba84cb61013dfee0914f9812b7608c029a47f/foo.json" needs an import attribute of "type: json"
at ignore-listed frames {
code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
}
}
⚠ Failed to import "next.config.ts" using Node.js native TypeScript resolution. Falling back to legacy resolution. {
cause: TypeError: Module "file:///private/var/folders/cm/328vyfy92k194zkm0jpl5sqw0000gn/T/next-install-0b4875510d429ddf1727b03e3cbba84cb61013dfee0914f9812b7608c029a47f/foo.json" needs an import attribute of "type: json"
at ignore-listed frames {
code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
}
}
✓ Starting...
⚠ Failed to import "next.config.ts" using Node.js native TypeScript resolution. Falling back to legacy resolution. {
cause: TypeError: Module "file:///private/var/folders/cm/328vyfy92k194zkm0jpl5sqw0000gn/T/next-install-0b4875510d429ddf1727b03e3cbba84cb61013dfee0914f9812b7608c029a47f/foo.json" needs an import attribute of "type: json"
at ignore-listed frames {
code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
}
}
✓ Ready in 316ms
```
#### After
```
running pnpm next build
⚠ Failed to import "next.config.ts" using Node.js native TypeScript resolution. Falling back to legacy resolution. {
cause: TypeError: Module "file:///private/var/folders/cm/328vyfy92k194zkm0jpl5sqw0000gn/T/next-install-baa26127b75b4c408a5e1a471c7b7908c7cd11e4843c7a9d850a2c0d8ca2eadb/foo.json" needs an import attribute of "type: json"
at ignore-listed frames {
code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
}
}
✓ Starting...
⚠ Failed to import "next.config.ts" using Node.js native TypeScript resolution. Falling back to legacy resolution. {
cause: TypeError: Module "file:///private/var/folders/cm/328vyfy92k194zkm0jpl5sqw0000gn/T/next-install-baa26127b75b4c408a5e1a471c7b7908c7cd11e4843c7a9d850a2c0d8ca2eadb/foo.json" needs an import attribute of "type: json"
at ignore-listed frames {
code: 'ERR_IMPORT_ATTRIBUTE_MISSING'
}
}
✓ Ready in 309ms
```
Showing
Please
register
or
sign in
to comment