aidenybai / million

Optimize React performance and make your React 70% faster in minutes, not months.
https://million.dev
MIT License
15.87k stars 554 forks source link

Million lint build error when configuring using webpack (TypeError: Cannot read properties of undefined (reading 'anya')) #1037

Open uriklar opened 1 month ago

uriklar commented 1 month ago

What version of million are you using?

1.0.0-rc.1

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Mac

What browser are you using?

Chrome

Describe the Bug

In my webpack (v.5.91.0) config I added:

import million from '@million/lint';
plugins: [
     million.webpack(),
     ... other plugins
    ]

And i'm getting this error:

  /Users/uriklar/Code/MY_PROJECT/node_modules/unplugin/dist/webpack/loaders/transform.js:104
  const plugin = (_a = this._compiler) == null ? void 0 : _a.$unpluginContext[unpluginName];
                                                                             ^

TypeError: Cannot read properties of undefined (reading 'anya')
    at Object.transform (/Users/uriklar/Code/MY_PROJECT/node_modules/unplugin/dist/webpack/loaders/transform.js:104:78)
    at LOADER_EXECUTION (/Users/uriklar/Code/MY_PROJECT/node_modules/loader-runner/lib/LoaderRunner.js:132:14)
    at runSyncOrAsync (/Users/uriklar/Code/MY_PROJECT/node_modules/loader-runner/lib/LoaderRunner.js:133:4)
    at iterateNormalLoaders (/Users/uriklar/Code/MY_PROJECT/node_modules/loader-runner/lib/LoaderRunner.js:251:2)
    at /Users/uriklar/Code/MY_PROJECT/node_modules/loader-runner/lib/LoaderRunner.js:224:4
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)

What's the expected result?

The build to pass

Link to Minimal Reproducible Example

https://stackblitz.com/sorry-cant-create-one-right-now

Participation

github-actions[bot] commented 1 month ago

Thanks for opening this issue! A maintainer will review it soon.

RishabhTayal commented 1 month ago

Same

ganapativs commented 1 month ago

Same issue here. Please look into this.

/Users/user/project/node_modules/.pnpm/unplugin@1.10.1/node_modules/unplugin/dist/webpack/loaders/transform.js:105

  if (typeof this.query === "string") {
    console.log(this.query); // ?unpluginName=anya
    const query = new URLSearchParams(this.query);
    unpluginName = query.get("unpluginName");
  } else {
    unpluginName = this.query.unpluginName;
  }
  const plugin = (_a = this._compiler) == null ? void 0 : _a.$unpluginContext[unpluginName];
grushetsky commented 2 weeks ago

I have encountered the same problem.