Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悶] Invalid module "@qwik-city-plan" is not a valid package name imported from #6024

Open
frixaco opened this issue Mar 17, 2024 · 12 comments
Labels
COMP: qwik-city P3: important If Bug - it makes Qwik unstable but doesn't affect the majority of users TYPE: bug Something isn't working

Comments

@frixaco
Copy link

frixaco commented Mar 17, 2024

Which component is affected?

Qwik Runtime

Describe the bug

Same/Related: #3641

Full error: TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "@qwik-city-plan" is not a valid package name imported from /Users/frixaco/dev/my/test-qwik-city-plan/node_modules/.pnpm/@builder.io+qwik-city@1.5.1_@types+node@20.11.28/node_modules/@builder.io/qwik-city/index.qwik.mjs

Let me know if you need more info.

Reproduction

https://github.com/frixaco/repro-qwik-city-plan-error

Steps to reproduce

(Same as the mentioned issue above)

  1. pnpm create qwik
  2. pnpm add @modular-forms/qwik
  3. routes/index.tsx:
import { component$ } from "@builder.io/qwik";
import { routeLoader$ } from "@builder.io/qwik-city";
import { useForm } from "@modular-forms/qwik";

export const useFormLoader = routeLoader$<any>(() => ({
  email: "",
  password: "",
}));

export default component$(() => {
  useForm<any>({
    loader: useFormLoader(),
  });

  return <></>;
});
  1. pnpm preview

System Info

System:
OS: MacOS Sonoma 14.2.1
CPU: Apple M2 Pro
Memory: 16 GB
Binaries:
Node: 20.11.0
NPM: 10.2.4
PNPM: 8.15.3

Additional Information

No response

@frixaco frixaco added STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working labels Mar 17, 2024
@wmertens
Copy link
Member

Can you try downgrading vite to 4.0, and if that fixes it, try to find which version breaks it

@frixaco
Copy link
Author

frixaco commented Mar 17, 2024

@wmertens Thanks for quick response. Sure, lemme try

@frixaco
Copy link
Author

frixaco commented Mar 17, 2024

@wmertens downgrading Vite to 4.x, 4.0 and 3.x versions didn't help, unfortunately. I'll play around with other packages

@wmertens
Copy link
Member

Ok then it's probably a bug in the Qwik City plugin

@wmertens wmertens added COMP: qwik-city P3: important If Bug - it makes Qwik unstable but doesn't affect the majority of users and removed STATUS-1: needs triage New issue which needs to be triaged labels Mar 17, 2024
@FelineJTD
Copy link

Is there a fix yet? I'm having the same problem.

@PatrickJS
Copy link
Member

you have to move your deps to devDeps
https://github.com/frixaco/repro-qwik-city-plan-error/blob/7a9c27ecdaf3ae2fde5da84d4723618fe06665db/package.json#L45

@PatrickJS
Copy link
Member

@wmertens this is a problem because of how we setup the vite.config https://github.com/frixaco/repro-qwik-city-plan-error/blob/7a9c27ecdaf3ae2fde5da84d4723618fe06665db/vite.config.ts#L34 and it's not clear. by default packages are installed in deps rather than devDeps so it's confusing because the error also doesn't provide any info

@frixaco
Copy link
Author

frixaco commented Apr 1, 2024

Thank you @PatrickJS! Moving @modular-forms/qwik from deps to devDeps fixed the problem.
As you said, it would be great if there was a more clear way to let people know about this. Maybe deps check + warning during pnpm dev or something.

@wmertens
Copy link
Member

wmertens commented Apr 1, 2024

Yes good point. Perhaps we should just comment that code and explain that for optimal packaging you need to use that

@wmertens
Copy link
Member

wmertens commented Apr 1, 2024

Checking the deps is possible too but kinda hard. For sure anything that depends on qwik should be bundled and we could do that automatically

@wmertens
Copy link
Member

wmertens commented Apr 1, 2024

Actually I think that already happens and we're overriding it

@PatrickJS
Copy link
Member

if we have a better error that should be good enough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP: qwik-city P3: important If Bug - it makes Qwik unstable but doesn't affect the majority of users TYPE: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants