million
million copied to clipboard
npx @million/lint@latest gatsby.js option doesn't work with gatsby-node.ts
What version of million
are you using?
@million/lint@latest
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
yarn
What operating system are you using?
Mac
What browser are you using?
Chrome
Describe the Bug
Running npx @million/lint@latest in gatsby project. I have my Gatsby config files as ts. After choosing the framework as Gatsby, instead of editing existing gatsby-node.ts file. it just created fresh gatsby-node.js with onCreateWebpackConfig hook.
PS: I already have million/compiler setup in gatsby-node.ts. In this case, should I use both?
import million from 'million/compiler'
import { webpack } from '@million/lint';
export const onCreateWebpackConfig: GatsbyNode['onCreateWebpackConfig'] =
function onCreateWebpackConfig({ actions }): void {
actions.setWebpackConfig({
plugins: [webpack(), million.webpack({ mode: 'react', server: true, auto: true })],
})
}
Thank you for your great work and project!
What's the expected result?
It should edit existing ts file and editing existing onCreateWebpackConfig function, instead of creating js file.
Link to Minimal Reproducible Example
sorry
Participation
- [ ] I am willing to submit a pull request for this issue.
Update: getting an error while running gatsby dev:
⚡ Million Lint v0.0.58
✓ Ready in 0.64ms
⚡ Million.js 3.0.3
- Tip: use // million-ignore for errors
- Hotline: https://million.dev/hotline
⚡ <Html> now renders ~50% faster
⚡ <Unverified> now renders ~33% faster
⚡ <ProfileIncomplete> now renders ~40% faster
🎁 Million Wrapped: https://million.dev/wrapped/36c5af2124fc2496ce68d8689f14b313
⚡ <DropdownOption> now renders ~83% faster
⚡ <ListBox> now renders ~67% faster
ERROR UNKNOWN
There was an error compiling the html.js component for the development server.
See our docs page on debugging HTML builds for help https://gatsby.dev/debug-html ReferenceError:
navigator is not defined
1 | import { useEffect, useState } from "react";
> 2 | var isInputPendingSupported = "scheduling" in navigator &&
| ^
3 | navigator.scheduling &&
4 | "isInputPending" in navigator.scheduling;
5 | var tasks = [];
WebpackError: ReferenceError: navigator is not defined
commenting out webpack() fixes an issue.
Thanks for opening this issue! A maintainer will review it soon.
Also seeing warning on yarn install: "@million/lint > [email protected]" has incorrect peer dependency "react@^16.13.1"
possible solution is to add a type guard typeof document !== 'undefined'
to make the code SSR friendly.
I'm having this same issue, thanks for working on it! I have mostly the same setup, except I set mine up according to the automatic instructions here: https://million.dev/docs/install.
I'm using gatsby version 4.24 & react version 18.2.
I had the same install process, but had generated js file as output. I'm using ts version, so I've just copied settings from js to ts, but got issues on dev build.
Thanks for this @JustFly1984, but, @NisargIO can help you here.
I'm having this same issue, thanks for working on it! I have mostly the same setup, except I set mine up according to the automatic instructions here: https://million.dev/docs/install.
I'm using gatsby version 4.24 & react version 18.2.
Actually the gatsby develop runs without the navigator error now, but when I try and access the local dev site it serves up, I get an "unhandled runtime error, cannot read properties of null (reading 'innerHTML') from line 6565 in the million/dist/packages/react-sever.mjs file.
When I try to run gatsby build I get this error: WebpackError: RangeError: Maximum call stack size exceeded
Thank you @JustFly1984 and @lmsutter, I have helped reported this to core team. Someone will respond to you soon.
Thank you @JustFly1984 and @lmsutter, I have helped reported this to core team. Someone will respond to you soon.
Never mind, I was confused but it got resolved.
Thank you @JustFly1984 and @lmsutter, I have helped reported this to core team. Someone will respond to you soon.
Never mind, I was confused but it got resolved.
Wait, I'm curious; could you share what you did please? Thanks.
I'm having this same issue, thanks for working on it! I have mostly the same setup, except I set mine up according to the automatic instructions here: https://million.dev/docs/install.
@lmsutter I think that's a completely different issue with million itself and not million lint. Let me know, if yes, create another issue please. Thank you so much.
I fixed this issue and it'll be included in the latest release soon.
I'm having this same issue, thanks for working on it! I have mostly the same setup, except I set mine up according to the automatic instructions here: https://million.dev/docs/install.
@lmsutter I think that's a completely different issue with million itself and not million lint. Let me know, if yes, create another issue please. Thank you so much.
yes, sorry, thank you!
Thank you @JustFly1984 and @lmsutter, I have helped reported this to core team. Someone will respond to you soon.
Never mind, I was confused but it got resolved.
Wait, I'm curious; could you share what you did please? Thanks.
Sounds like this is resolved. I was confused and I didn't want to add to the confusion, if it helps to hear my process though. Million/lint is not working for me currently but I'm looking forward to trying the new release.
So I am using the typescript version of gatsby-node.ts like the original poster. When I ran pnpx install @million/lint@latest (pnpm is my package manager) the install went fine and it added a gatsby-node.js file with what looks like the correct setup. I am able to run my gatsby app fine (gatsby develop) but I don't see anything besides the basic text in the million/lint plugin section of vs code.
When I try to add in the webpack config to my gatsby-node.ts file like this:
export const onCreateWebpackConfig: GatsbyNode['onCreateWebpackConfig'] = (
args,
) => {
args.actions.setWebpackConfig({
plugins: [MillionCompiler.webpack()],
});
createPathAliases(args);
disableSourceMaps(args);
};
and run gatsby develop I get this error:
ERROR #11321 PLUGIN
"gatsby-node.js" threw an error while running the onCreateNode lifecycle:
Cannot access 'i' before initialization
25 | }; 26 |
27 | export const onCreateNode: GatsbyNode['onCreateNode'] = async (args) => { | ^ 28 | await createAssetNodes(args); 29 | await createInlineSvgNodeField(args); 30 | await createStoryblokPageNode(args);
File: gatsby-node.ts:27:14
My onCreateNode export is right after the onCreateWebpack config export so I'm guessing that's maybe why the error is showing up for that line?
Deleting the gatsby-node.js file didn't help.
Hope that helps, sorry! Sounds like this has been resolved. Thanks for reaching out.
update: updated to 0.0.66, still getting navigator error
update: updated to 0.0.66, still getting navigator error
My fix has not been included yet.
@lmsutter Could you please create another issue for this? So I investigate it.
I'm running into the same issue.
Thank you for reporting this @JustFly1984, I have communicated this issue with the team. Thank you!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.
not stale
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.
Not stale
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.
Not stale