onwidget / qwind

⭕️ Qwind: A template to make your website using Qwik + Tailwind CSS.
https://qwind.pages.dev
MIT License
251 stars 68 forks source link

PNPM BUILD fails with ERROR for @unpic/core #9

Closed sarvex closed 1 year ago

sarvex commented 1 year ago
pnpm build
[vite]: Rollup failed to resolve import "@unpic/core" from "D:/Source/qwind-starter/src/s_w1wzaavnrf0.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "@unpic/core" from "D:/Source/qwind-starter/src/s_w1wzaavnrf0.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
spectraisdeadaf commented 1 year ago

Yo, from what I can tell Vite is not able to find the module @unpic/core in your project, could you confirm it is in fact installed. Once you have done that you need to add it to the build.rollupOptions.external array. This will tell Vite to not try to bundle the module with your application.

Open your vite.config.js file and add the following line to the build.rollupOptions object: external: ['@unpic/core']

sarvex commented 1 year ago

@spectraisdeadaf I have tried all these things and nothing worked.

  1. Ensure @unpic/qwik is installed
  2. Added @unpic/qwik to build.rollupOptions.external

Now this happens only when vercel edge integration is added.

spectraisdeadaf commented 1 year ago

Thats weird, have you used the --save flag when installing @unpic/core. (npm install --save @unpic/core) Maybe it was not added to your project's package.json file and does not get installed with your build script.

sarvex commented 1 year ago

@spectraisdeadaf the dependency is saved alright in the package.json. The whole thing works fine in the local environment till I add the vercel edge integration to the project.

spectraisdeadaf commented 1 year ago

oh okay, could you share a snippet of the code in the file it is throwing the error for?

sarvex commented 1 year ago

@spectraisdeadaf apologies I did not mention the steps of reproduction earlier.

  1. Use the repository as a template and create a new project.
  2. pnpm build works fine without a glitch
  3. Add vercel edge as a dependency using pnpm qwik add
  4. pnpm build fails with the error mentioned earlier.
spectraisdeadaf commented 1 year ago

Hey so I cloned the site and managed reproducing the error. I fixed it by adding the following to vite config (None Existent Path would be D:/Source/qwind-starter/src/s_w1wzaavnrf0.js for you )

build: {
            rollupOptions: {
              external: '<None Existent Path>'
            }
          },

ShoT_2023-06-08-03-43-05_1920x1080

sarvex commented 1 year ago

Yeah @spectraisdeadaf but this suppresses the error, not fix it.

prototypa commented 1 year ago

Hello @sarvex

This template is intended to be generated static. The "@vercel/edge" dependency is not needed.