qwik icon indicating copy to clipboard operation
qwik copied to clipboard

Rollup failed to resolve import "@qwik-city-not-found-paths" during `npm run preview`

Open Gelio opened this issue 3 years ago • 3 comments

Qwik Version

0.13.3

Operating System (or Browser)

Ubuntu 20.04 LTS

Node Version (if applicable)

v18.12.1

Which component is affected?

Qwik Rollup / Vite plugin

Expected Behaviour

npm run preview works without errors

Actual Behaviour

Building client modules in npm run preview fails with the following error:

✓ Built client modules

[vite]: Rollup failed to resolve import "@qwik-city-not-found-paths" from "node_modules/@builder.io/qwik-city/middleware/node/index.mjs".
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 "@qwik-city-not-found-paths" from "node_modules/@builder.io/qwik-city/middleware/node/index.mjs".
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`
    at onRollupWarning (file:///home/voreny/projects/wedding-site/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:45526:19)
    at onwarn (file:///home/voreny/projects/wedding-site/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:45297:13)
    at Object.onwarn (file:///home/voreny/projects/wedding-site/node_modules/rollup/dist/es/shared/rollup.js:23263:13)
    at ModuleLoader.handleResolveId (file:///home/voreny/projects/wedding-site/node_modules/rollup/dist/es/shared/rollup.js:22158:26)
    at file:///home/voreny/projects/wedding-site/node_modules/rollup/dist/es/shared/rollup.js:22119:26

Additional Information

I just upgraded to

    "@builder.io/qwik": "0.13.3",
    "@builder.io/qwik-city": "0.0.123",

and got this issue. npm run build and npm run dev work fine. I don't have any adaptors installed.

My vite.config.ts is the default one:

import { defineConfig } from "vite";
import { qwikVite } from "@builder.io/qwik/optimizer";
import { qwikCity } from "@builder.io/qwik-city/vite";
import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig(() => {
  return {
    plugins: [qwikCity(), qwikVite(), tsconfigPaths()],
  };
});

Gelio avatar Nov 20 '22 14:11 Gelio

Same error, happens with a fresh install of qwik and immediately upgrading qwik-city.

  1. npm create qwik@latest (qwik city app)
  2. npm install -D @builder.io/qwik-city@latest
  3. npm run preview
"@builder.io/qwik": "0.13.3",
"@builder.io/qwik-city": "0.0.123",

leeschmidt4 avatar Nov 21 '22 00:11 leeschmidt4

I had the same issue and resolved it by downgrading qwik-city to 0.0.122

nkuek avatar Nov 21 '22 01:11 nkuek

If you are in a local environment, you can add the following options to make it work.

build: {
  rollupOptions: {
    external: ["@qwik-city-not-found-paths", "@qwik-city-static-paths"],
  },
},

activeguild avatar Nov 21 '22 15:11 activeguild

Should be fixed in with!

    "@builder.io/qwik": "0.14.0",
    "@builder.io/qwik-city": "0.0.125",

Thanks for the issue!!

manucorporat avatar Nov 22 '22 11:11 manucorporat

Thanks for the fix, I've just upgraded and it seems to work well now :ok_hand:

Gelio avatar Nov 22 '22 11:11 Gelio