Closed Josehower closed 3 years ago
Hi @Josehower!
Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.
We have tried the example above and we couldn't see the above error.
If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.
Thanks for using Gatsby! 💜
@wardpeet in trying to help José a bit just now, I thought it was maybe related to your PR over here: https://github.com/gatsbyjs/gatsby/pull/29576#issuecomment-827504491
I guess there may still be an issue with TypeScript (user-created .tsx and .ts files that use imports with .js
file extensions) though, which may be the missing detail here.
🤔 maybe. Packages should not export ts or tsx files. I would love some kind of reproduction :)
Yep, José is working on one now, should be here soon :)
https://codesandbox.io/s/serene-leaf-2vivd?file=/src/components/layout.tsx
here you have the link for an Out of the box gatsby sandbox with minimal changes the changes done:
Note: make sure you go to the browser port: 8000 tab
To be clear what we're trying to do:
"type": "module"
in package.json
.js
extension)babel-loader
(via babel-preset-gatsby
)With regular TypeScript, this works, and is recommended: https://github.com/microsoft/TypeScript/issues/41887#issuecomment-741968855
This is the intended behavior; because TypeScript doesn't modify JavaScript code you write, the import path you write should be the one you want to appear in the output
.js
file
With Gatsby TypeScript, it doesn't work.
Edit: Upon further reflection, this seems like a bug in webpack's module resolution algorithm (or in babel-loader
and ts-loader
)
@Josehower will create issues over there.
Edit 2: Issue for webpack open: https://github.com/webpack/webpack/issues/13252
Hiya!
This issue has gone quiet. Spooky quiet. 👻
We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 💪💜
Hey again!
It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY
. Please feel free to comment on this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks again for being part of the Gatsby community! 💪💜
Description
When using fully specified paths in imports e.g export { quiz as jsFunctions } from './js-functions.js';
gatsby send this error message
Steps to reproduce
type: module
to package.jsonExpected result
Gatsby should allow imports with .js extention
Actual result
Gatsby fail trying to generate JavaScript bundle
Environment
Run
gatsby info --clipboard
in your project directory and paste the output here.$ yarn gatsby info --clipboard yarn run v1.22.5 $ D:\upleveled-softwork\courses\node_modules.bin\gatsby info --clipboard
System: OS: Windows 10 10.0.19041 CPU: (4) x64 Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz Binaries: Node: 16.0.0 - ~\AppData\Local\Temp\yarn--1619542324765-0.4257021548777624\node.CMD Yarn: 1.22.5 - ~\AppData\Local\Temp\yarn--1619542324765-0.4257021548777624\yarn.CMD npm: 7.10.0 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 90.0.4430.93 Edge: Spartan (44.19041.906.0), Chromium (90.0.818.46)
✨ Done in 4.44s.