preactjs / wmr

👩‍🚀 The tiny all-in-one development tool for modern web apps.
https://wmr.dev/
MIT License
4.92k stars 109 forks source link

rollup version is too old (is fake) #923

Open Aloento opened 2 years ago

Aloento commented 2 years ago
"@wmrjs/service-worker@^0.3.1":
  version "0.3.1"
  dependencies:
    rollup "^2.0.0"
rollup@^2.0.0:
  version "2.70.1"

then "@rollup/plugin-commonjs" requires at least rollup@2.38 but found rollup@2.8.0. Cannot fix this by yarn add -D rollup

I recommend you to use the dependence bot or npm-check-updates to keep new for your deps.

rschristian commented 2 years ago

We're using Rollup 2.52.7:

https://github.com/preactjs/wmr/blob/caf7ff840363351b0f52eabf1eff91c3e9888c04/packages/wmr/package.json#L81

Our deps are all inlined, so if you have rollup in your lock file then it hasn't come from installing WMR.

Aloento commented 2 years ago

I know wmr is new but my old rollup is from your package @wmrjs/service-worker It's also your package, or maybe you don't maintain this package, then I will remove it.

rschristian commented 2 years ago

Your lock file clearly shows it resolving to 2.70, so I don't know what is referring to 2.8, but it's not us I don't think.

Aloento commented 2 years ago

Yes, I am also confused about this. I try to look for the node_modules and see what exactly the version is. And it's the newest version of rollup but, the plug-in always says it's the old version. I use a new project and I will show you the debug things.

Aloento commented 2 years ago
SoarT@Soar-Blade ~\Downloads\WMR ❯❯❯ yarn run start
Debugger attached.
yarn run v1.22.18
$ wmr
Debugger attached.

Error: Insufficient Rollup version: "@rollup/plugin-commonjs" requires at least rollup@2.38 but found rollup@2.8.0.
    at validateRollupVersion (C:\Users\SoarT\Downloads\WMR\node_modules\@rollup\plugin-commonjs\dist\index.js:682:11)
    at Object.buildStart (C:\Users\SoarT\Downloads\WMR\node_modules\@rollup\plugin-commonjs\dist\index.js:1791:7)
    at C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:2973713
    at Array.map (<anonymous>)
    at Object.buildStart (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:2973677)
    at Dwt (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:3009029)
    at eDt (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:3021787)
    at async Zwt (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:3021244)

Waiting for the debugger to disconnect...
error Command failed with exit code 1.

image image

rschristian commented 2 years ago

Why are you installing @rollup/plugin-commonjs out of curiosity? I could not reproduce the error locally when adding @wmrjs/service-worker to an app.

Aloento commented 2 years ago

reproduce this error just with yarn add @rollup/plugin-commonjs

wmr.config.mjs import commonjs from "@rollup/plugin-commonjs"; plugins: [commonjs()],

then you cannot start wmr.

I'm trying to solve this problem so I add @rollup/plugin-commonjs Currently, I can't use WMR to working my project at all.

rschristian commented 2 years ago

Hm, still cannot reproduce that error. Can you clear node_modules and your lock file and try installing again? What version of Yarn are you using? I'm on 1.22.18 which seems to be working.

All I've done is create a new project, add that plugin, and add it to the config. Is that a correct reproduction?

Aloento commented 2 years ago

Let me clean everything and restart my computer, then see what will happen.


Ok, still wrong...

Let me use Linux to try again.


Not working.... outrageous

rschristian commented 2 years ago

Can you try cloning and running this?

https://github.com/rschristian/wmr-rollup-cjs

Try installing with yarn --frozen-lockfile

Aloento commented 2 years ago

this is my env, I will try yours. https://github.com/Aloento/WMR


Still wrong... I suspect there may be something wrong with my environment. Let me open a virtual machine and try it.

rschristian commented 2 years ago

I'm on Linux,, using Yarn v1 (1.22.18), if it helps. Bizarre issue.

Aloento commented 2 years ago

Still wrong in clean Win 11 virtual machine (Sandbox). With nodejs 17.9.0 and yarn v1.22.18 I now try with Linux virtual machine.


Still wrong... omg...

rschristian commented 2 years ago

I'm on Node 14.19.1, though I don't think anything's really changed there.

Aloento commented 2 years ago

I tried with your node version and it's started but still thrown... funny...

(node:6804) UnhandledPromiseRejectionWarning: Error: Insufficient Rollup version: "@rollup/plugin-commonjs" requires at least rollup@2.38 but found rollup@2.8.0.
    at validateRollupVersion (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\@rollup\plugin-commonjs\dist\index.js:682:11)
    at Object.buildStart (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\@rollup\plugin-commonjs\dist\index.js:1791:7)
    at C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\wmr\wmr.cjs:2:2973713
    at Array.map (<anonymous>)
    at Object.buildStart (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\wmr\wmr.cjs:2:2973677)
    at Dwt (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\wmr\wmr.cjs:2:3009029)
    at eDt (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\wmr\wmr.cjs:2:3021787)
    at async Zwt (C:\Users\WDAGUtilityAccount\Desktop\wmr-rollup-cjs-master\node_modules\wmr\wmr.cjs:2:3021244)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6804) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6804) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

  👩‍🚀 WMR dev server running at:

  Local:   http://localhost:8080
  Network: (disabled, see --host)

And the page cannot be showing.

I'm giving up.

rschristian commented 2 years ago

Shoot, I'm really sorry, I didn't notice you were running the dev server.

I can reproduce there. Can you confirm that wmr build doesn't result in that error?

Aloento commented 2 years ago
SoarT@Soar-Blade ~\Downloads\WMR git:master ❯❯❯ yarn run build
Debugger attached.
yarn run v1.22.18
$ wmr build --prerender
Debugger attached.

SyntaxError: Unexpected token: punc (:)
  1 | …
> 2 | …pos=i}}function nd(e,t,n,r,i){throw new td(e,t,n,r,i)}function rd(e,t,n){…
    |                                      ^

    at nd (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:399363)
    at B (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:408097)
    at c (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:408188)
    at l (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:408241)
    at m (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:408780)
    at _ (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:412876)
    at e (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:409997)
    at C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:408887
    at E (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:412606)
    at e (C:\Users\SoarT\Downloads\WMR\node_modules\wmr\wmr.cjs:2:409993)

Waiting for the debugger to disconnect...
error Command failed with exit code 1.
rschristian commented 2 years ago

Well... different error is progress?

developit commented 2 years ago

The official Rollup commonjs plugin won't work with WMR's dev server, because it's not a full Rollup implementation. The version number is fake, but even if that were updated this wouldn't work - it's missing things like the plugin metadata API. Also, the way the CommonJS plugin works is extremely complex and retains data across multiple plugin passes, which does not work with the model WMR uses where each file is an individual HTTP request.

That error looks like TypeScript is being authored in a non-TypeScript file (.js or .mjs).

Aloento commented 2 years ago

uh... I didn't write any type... https://github.com/preactjs/wmr/issues/922 should reopen... So do you have any solution for the commonjs?

rschristian commented 2 years ago

@developit Interestingly the package that's throwing the error (react-helmet-async) is one built with Microbundle.... Granted might be in one of the deps, the error position doesn't exactly make it clear.

developit commented 2 years ago

@rschristian I thought it was because of the scheduler package?

rschristian commented 2 years ago

They've had two separate issues with two separate packages: