-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Typescript by default" interferes with ts-loader in Webpack build #26027
Comments
I have created a simple reproduction with a default starter here: All it does is dump the webpack config to disk for examination. I would expect to see a If so desired, I can extend it to showcase the issue when using |
I know why I don't see it now. It's because of the timing for when
|
Description
Since it was decided that
gatsby-plugin-typescript
should be included by default, I have issues runningts-loader
beside it.ts-loader
winds up throwing a ton of type errors like some of these belowIt's apparent to me that the types are being stripped from the code before it reaches
ts-loader
, which seemed a bit odd. The Webpack config snippet in question is here:This shouldn't be an issue because I've run
ts-loader
on top ofbabel-loader
with@babel/preset-typescript
set up before and never had any issues. To me, this sounds like another loader is hitting the.ts
files first, which would make sense becausegatsby-plugin-typescript
sets up that loader. Under normal circumstances, I would drop the entry from the Webpack config, but...I don't see it in the generated config. I have a function like this for debugging:
I have examined the generated config from top to bottom, and I don't see the loader that gets added by
gatsby-plugin-typescript
. I've confirmed that it is the culprit by dropping these lines, though:gatsby/packages/gatsby/src/bootstrap/load-plugins/load.ts
Lines 267 to 279 in 222920b
So I guess I have a couple of questions:
Why isn't
onCreateWebpack()
getting hit with the correct webpack configCan we set up a way to switch on/off the "typescript by default" feature?
I frequently use Typescript plugins, and it's just not possible to use them through Babel, because it relies on typescript itself doing the transpiling/type-checking. Hence,
ts-loader
.When I have the time in a couple days, I will create a reproduction. I'm on a time crunch right now, and I've already been on this issue for too long.
The text was updated successfully, but these errors were encountered: