-
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
fix(gatsby-parcel-config): Adjust dependencies #36583
Conversation
Dont know why, I had to add YAML transformer parcel to fix build error: ``` ERROR gatsbyjs#11901 COMPILATION Failed to compile Gatsby files (@parcel/core): Could not determine version of @parcel/transformer-yaml in node\_modules/gatsby-parcel-config/lib/index.json. Either include it in "dependencies" or "parcelDependencies".. File path: XXXX/node_modules/gatsby-parcel-config/package.json not finished compile gatsby files - 0.392s ```
it was set already |
We shouldn't handle |
@LekoArt agree, I found weird to have to do this fix, but how to do that on a gatsby application? And just curious, how could I use this fix in my Many thanks |
@LekoArts would you mind sharing what's the reasoning behind your comment #36583 (comment) ? |
@ebuildy You can use @miensol We use Parcel to transform TypeScript to JavaScript. It shouldn't do more and the TypeScript should be "valid" code for Node.js as in: For example Node by default doesn't support just loading YAML files, one has to use https://www.npmjs.com/package/yaml. So if you want, you can compare behavior to the |
Thanks @LekoArts . |
Historically speaking the |
How can we handle now the import of |
@omardeangelis can you open an issue with a minimal reproduction? I just tried importing a JSON file in gatsby-config with |
I'm having similar problems:
How to resolve this? |
Try to import inside gatsby.node.ts |
I built a simple workaround for this, as we have a monorepo where we import specific keys from a Added this command as a Here is the contents of the
I added the extra prettier step so we do not get any conflicts with our eslint/prettier config. This isn't ideal, but something quick while we wait for a more permanent solution from gatsby. |
Node by default doesn't support importing JSON files in ESM (see https://www.stefanjudis.com/snippets/how-to-import-json-files-in-es-modules-node-js/) You can use import fs from "fs"
const data = JSON.parse(fs.readFileSync("./data.json", "utf8")) However, I understand that it's an easy to have "Quality of Life" improvement so I'll re-add the JSON transformer. |
I've put up #36748 |
Thanks, think that the problem is that this PR and the official docs say different things. Can i ask you what are the benefits of the JSON transformer removal ? pure curiosity |
This is using CommonJS with |
Description
Add YAML transformer parcel
Related Issues
I had to add YAML transformer parcel to fix build error: