__dirname
inaccurate in TS gatby-configs
#35488
Labels
type: bug
An issue or pull request relating to a bug in Gatsby
__dirname
inaccurate in TS gatby-configs
#35488
Preliminary Checks
Description
In porting some older Gatsby 3 projects to 4, I also converted the
gatsby-config.js
to.ts
as we use Typescript and typesafe configs are 💯 🏆 🔥Our
gatsby-config
s tend to use__dirname
(eg forgatsby-plugin-root-import
,gatsby-source-filesystem
, etc.) This does not work as intended in TS gatsby-configs. Presumably, because of transpiling,__dirname
will instead reference[project]/.cache/compiled
Reproduction Link
https://github.com/gatsbyjs/gatsby/tree/master/starters/default
Steps to Reproduce
I created two basic starters
gatsby new
, one TS, one JS, and added to each's gatsby-config:Output of
gatsby build
for JS version (correct):Output of
gatsby build
for TS version (incorrect):Expected Result
__dirname
should be the project source directoryActual Result
__dirname
will instead reference[project]/.cache/compiled
for TS gatsby-configsEnvironment
Config Flags
No response
The text was updated successfully, but these errors were encountered: