million: 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.

About this issue

  • Original URL
  • State: open
  • Created 4 months ago
  • Reactions: 3
  • Comments: 23 (4 by maintainers)

Most upvoted comments

update: updated to 0.0.66, still getting navigator error

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.