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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use with nuxt 3.12.1, The entry point "vue" cannot be marked as external #641

Closed
baixiaoyu2997 opened this issue Jun 12, 2024 · 18 comments

Comments

@baixiaoyu2997
Copy link
Contributor

baixiaoyu2997 commented Jun 12, 2024

error log:

> @deorderbook/storybook@0.0.1 prepare:base
> nuxi prepare ../../packages/base --dotenv .env.development


 WARN  [nuxt] Expected @nuxt/schema to be at least 3.12.1 but got 0.0.1. This might lead to unexpected behavior. Check your package.json or refresh your lockfile.                                                              2:35:00 PM


[2:35:03 PM]  WARN  Duplicated imports "CacheMapItem", the one from "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useActionCache.ts" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useAsyncCache.ts" is used

✔ Types generated in ../../packages/base/.nuxt                                                                                                                                                                                 2:35:03 PM

> @deorderbook/storybook@0.0.1 prepare:nuxt
> nuxi prepare --dotenv .env.development


 WARN  [nuxt] Expected @nuxt/schema to be at least 3.12.1 but got 0.0.1. This might lead to unexpected behavior. Check your package.json or refresh your lockfile.                                                              2:35:05 PM


[2:35:17 PM]  WARN  Duplicated imports "CacheMapItem", the one from "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useActionCache.ts" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useAsyncCache.ts" is used


 WARN  Duplicated imports "useNetwork", the one from "@vueuse/core" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useNetwork.ts" is used                               2:35:17 PM


 WARN  Duplicated imports "useTimestamp", the one from "@vueuse/core" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useTimestamp.ts" is used                           2:35:17 PM

✔ Types generated in .nuxt                                                                                                                                                                                                     2:35:18 PM
@storybook/cli v8.1.6

WARN The following packages are incompatible with Storybook 8.1.6 as they depend on different major versions of Storybook packages:
WARN - storybook-addon-vue-slots@0.9.29
WARN 
WARN 
WARN Please consider updating your packages or contacting the maintainers for compatibility details.
WARN For more on Storybook 8 compatibility, see the linked GitHub issue:
WARN https://github.com/storybookjs/storybook/issues/26031
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
info => Serving static files from ./../../packages/base/public at /
info => Starting manager..
WARN No story files found for the specified pattern: stories/**/*.mdx
WARN No story files found for the specified pattern: stories/**/*.stories.@(js|jsx|mjs|ts|tsx)
info => Starting preview..
[nuxt] Expected `@nuxt/schema` to be at least `3.12.1` but got `0.0.1`. This might lead to unexpected behavior. Check your package.json or refresh your lockfile.
Duplicated imports "CacheMapItem", the one from "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useActionCache.ts" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useAsyncCache.ts" is used
Duplicated imports "useNetwork", the one from "@vueuse/core" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useNetwork.ts" is used
Duplicated imports "useTimestamp", the one from "@vueuse/core" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useTimestamp.ts" is used
Duplicated imports "useTokens", the one from "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useTokens.ts" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/mocks/useTokens.ts" is used
Duplicated imports "useChains", the one from "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useChains.ts" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/mocks/useChains.ts" is used
Duplicated imports "useSwitchChain", the one from "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useSwitchChain.ts" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/mocks/useSwitchChain.ts" is used
ℹ Building client...                                                                                                                                                                                                           2:35:46 PM
ℹ vite v5.2.13 building for development...                                                                                                                                                                                     2:35:46 PM
transforming (1) ../../node_modules/.pnpm/nuxt@3.12.1_@opentelemetry+api@1.9.0_@parcel+watcher@2.4.1_@types+node@20.14.2_bufferutil@4.0_qbfdr756rzyp5tee3axvn4nyqq/node_modules/nuxt/dist/app/entry.jsDuplicated imports "CacheMapItem", the one from "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useActionCache.ts" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useAsyncCache.ts" is used
Duplicated imports "useNetwork", the one from "@vueuse/core" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useNetwork.ts" is used
Duplicated imports "useTimestamp", the one from "@vueuse/core" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useTimestamp.ts" is used
Duplicated imports "useTokens", the one from "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useTokens.ts" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/mocks/useTokens.ts" is used
Duplicated imports "useChains", the one from "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useChains.ts" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/mocks/useChains.ts" is used
Duplicated imports "useSwitchChain", the one from "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/composables/useSwitchChain.ts" has been ignored and "/Users/l.rain/Documents/workspace/deorderbook-monorepo/packages/base/mocks/useSwitchChain.ts" is used
ℹ ✓ 1569 modules transformed.                                                                                                                                                                                                  2:36:00 PM
ℹ .nuxt-storybook/dist/client/manifest.json                            4.13 kB │ gzip:   0.77 kB                                                                                                                               2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Poppins-Medium.CWICHMj6.woff2      7.74 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Poppins-Light.CAodptMY.woff2       7.84 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Poppins-Bold.g9MkRaG0.woff2        7.85 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Poppins-Regular.BwTUGeWf.woff2     7.90 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Poppins-SemiBold.DJVo7c07.woff2    7.99 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Inter-Regular.HwlC4K_u.woff2      21.62 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Inter-Light.SRi3KlYD.woff2        22.53 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Inter-Medium.Dg6cnWTD.woff2       22.74 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Inter-SemiBold.CLku1n6t.woff2     22.82 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Inter-Bold.q5z97_RC.woff2         22.94 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/error-bg.CSg96yYH.webp            30.44 kB                                                                                                                                                 2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/index.B_SY1GJM.css                 0.00 kB │ gzip:   0.02 kB                                                                                                                               2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/entry.Bop3rqe0.css                42.27 kB │ gzip:   6.63 kB                                                                                                                               2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/CtKNy-BD.js                        0.29 kB │ gzip:   0.25 kB                                                                                                                               2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/rp_bXKxD.js                      249.05 kB │ gzip:  22.42 kB                                                                                                                               2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/Ny9eeZ7e.js                      252.01 kB │ gzip:  26.43 kB                                                                                                                               2:36:01 PM
ℹ .nuxt-storybook/dist/client/_nuxt/DOD3vPVW.js                      340.43 kB │ gzip: 124.68 kB                                                                                                                               2:36:01 PM
ℹ ✓ built in 15.24s                                                                                                                                                                                                            2:36:01 PM
✔ Client built in 15266ms                                                                                                                                                                                                      2:36:01 PM
ℹ Building server...                                                                                                                                                                                                           2:36:01 PM
ℹ vite v5.2.13 building SSR bundle for development...                                                                                                                                                                          2:36:01 PM
ℹ ✓ 1 modules transformed.                                                                                                                                                                                                     2:36:01 PM
ℹ .nuxt-storybook/dist/server/styles.mjs  0.07 kB                                                                                                                                                                              2:36:01 PM
ℹ .nuxt-storybook/dist/server/server.mjs  0.06 kB                                                                                                                                                                              2:36:01 PM
ℹ ✓ built in 34ms                                                                                                                                                                                                              2:36:01 PM
✔ Server built in 57ms                                                                                                                                                                                                         2:36:01 PM
ℹ Initializing prerenderer                                                                                                                                                                                               nitro 2:36:01 PM
ℹ Prerendering 4 initial routes with crawler                                                                                                                                                                             nitro 2:36:03 PM
  ├─ /index.html (41ms)                                                                                                                                                                                                   nitro 2:36:03 PM
  ├─ /200.html (42ms)                                                                                                                                                                                                     nitro 2:36:03 PM
  ├─ /404.html (42ms)                                                                                                                                                                                                     nitro 2:36:03 PM
  ├─ / (44ms)                                                                                                                                                                                                             nitro 2:36:03 PM
ℹ Prerendered 4 routes in 1.51 seconds                                                                                                                                                                                   nitro 2:36:03 PM
✔ Generated public .vercel/output/static                                                                                                                                                                                 nitro 2:36:03 PM
✔ You can preview this build using npx serve .vercel/output/static                                                                                                                                                       nitro 2:36:03 PM
ℹ Re-optimizing dependencies because lockfile has changed                                                                                                                                                                      2:36:03 PM
╭─────────────────────────────────────────────────────╮                                                                                                                                                                         2:36:03 PM
│                                                     │
│   Storybook 8.1.6 for @storybook-vue/nuxt started   │
│   830 ms for manager and 38 s for preview           │
│                                                     │
│    Local:            http://localhost:9009/         │
│    On your network:  http://10.1.1.150:9009/        │
│                                                     │
╰─────────────────────────────────────────────────────╯
✘ [ERROR] The entry point "vue" cannot be marked as external


 ERROR  Unhandled promise rejection: Build failed with 1 error:                                                                                                                                                                 2:36:06 PM
error: The entry point "vue" cannot be marked as external

  error: The entry point "vue" cannot be marked as external
  at failureErrorWithLog (/Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1651:15)
  at /Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1059:25
  at /Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1527:9
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


 ERROR  [nitro] [unhandledRejection] Build failed with 1 error:                                                                                                                                                                 2:36:06 PM
error: The entry point "vue" cannot be marked as external

  error: The entry point "vue" cannot be marked as external
  at failureErrorWithLog (/Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1651:15)
  at /Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1059:25
  at /Users/l.rain/Documents/workspace/deorderbook-monorepo/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js:1527:9
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

deps:

"nuxt": "3.12.1",
"@storybook/vue3": "^8.1.6",
"@nuxtjs/storybook": "^8.1.1",
"@storybook/addon-actions": "^8.1.6",
    "@storybook/addon-essentials": "^8.1.6",
    "@storybook/addon-interactions": "^8.1.6",
    "@storybook/addon-links": "^8.1.6",
    "@storybook/blocks": "^8.1.6",
    "@storybook/builder-vite": "^8.1.6",
"@storybook/test": "^8.1.6",
"storybook": "^8.1.6",
    "storybook-addon-vue-slots": "^0.9.29",

I did not enable any nuxt4 features, rolling back nuxt to 3.11.2 can solve this problem

@seancrater
Copy link

seancrater commented Jun 12, 2024

I'm also getting this error in a Nuxt repo with our version set to ^3.11.2.

@Ragura
Copy link

Ragura commented Jun 14, 2024

The examples in the docs also give this error when running pnpm storybook.

@Lillojohn
Copy link

main.ts

framework: {
    name: "@storybook/vue3-vite",
    options: {},
  },

@tobiasdiez
Copy link
Collaborator

This is a result of nuxt/nuxt#27372 and is fixed with #634.

@chakAs3 could you please release a new version of the storybook addon (packages\storybook-nuxt). Thanks!

@chakAs3
Copy link
Collaborator

chakAs3 commented Jun 20, 2024

First, I have an issue with the package build. Second, using the release script will create a mess with the versions.

image

Previously, my deployment action was simply using pnpm publish with NPM registry credentials. I'm not sure what script you're using after the repo migration, and I'm quite busy these days, so I'm feeling a bit lost.

@tobiasdiez
Copy link
Collaborator

@chakAs3 Thanks a lot for the release! In #655, I've updated the release script to be compatible with the new repo structure. Just run pnpm release in the root and it will release both the storybook addon and the nuxt module (with the same version).

Could you please also add the NPM deployment token as a secret to github so that I can setup nightly builds? #562 That would be awesome!

@dentropy
Copy link

This issue does not seem to be resolved,

#663 (comment)

@kswzr
Copy link

kswzr commented Sep 2, 2024

The issue exists also with nuxt 3.12.4...

@Marian-Calin-Stroescu-Fiskars

facing the same issue when upgrading to nuxt 3.13.0

@timmywiff
Copy link

I'm also experiencing this issue. I can't find a combination of Nuxt and Storybook that works.

@tobiasdiez
Copy link
Collaborator

Can you please provide a reproduction? Thanks

@Nessjk
Copy link

Nessjk commented Oct 2, 2024

Still getting that error on Nuxt version "3.13.0".

Rolled back to "3.11.2"

Then ran:
rm -rf node_modules rm pnpm-lock.yaml pnpm install

All is working now

@hey-david-perez
Copy link

hey-david-perez commented Oct 5, 2024

I can confirm the same error happens to my with this setup on a Nuxt layer

{
  "name": "ui-nuxt-layer",
  "type": "module",
  "version": "0.0.1",
  "main": "./nuxt.config.ts",
  "scripts": {
    "dev": "nuxi dev .playground",
    "dev:prepare": "nuxt prepare .playground",
    "build": "nuxt build .playground",
    "generate": "nuxt generate .playground",
    "preview": "nuxt preview .playground",
    "lint": "eslint .",
    "storybook": "storybook dev --port 6006",
    "build-storybook": "storybook build"
  },
  "devDependencies": {
    "@nuxt/eslint": "latest",
    "@nuxtjs/storybook": "^8.2.0",
    "eslint": "^9.11.0",
    "nuxt": "^3.13.0", // ✅ 3.11.2 Works fine with pnpm run storybook ✅ 
    "typescript": "^5.6.2",
    "vue": "latest",
    "storybook": "8.3.5",
    "@types/node": "^18.17.5",
    "@storybook/vue3": "8.3.5",
    "@storybook-vue/nuxt": "0.2.6",
    "@storybook/addon-links": "8.3.5",
    "@storybook/builder-vite": "8.3.5",
    "@storybook/addon-essentials": "8.3.5",
    "@storybook/addon-interactions": "8.3.5",
    "@storybook/test": "8.3.5",
    "@storybook/blocks": "8.3.5"
  }
}

However, trying to run pnpm run dev does not work, as the .playground folder shows this message, even with .storybook/main.ts being present

 ERROR  [unhandledRejection] No configuration files have been found in your configDir: /repo/.playground/.storybook.                                            8:00:57 PM
Storybook needs a "main.js" file, please add it.

You can pass a --config-dir flag to tell Storybook, where your main.js file is located at.

More info: https://storybook.js.org/docs/configure


  Storybook needs a "main.js" file, please add it.
  
  You can pass a --config-dir flag to tell Storybook, where your main.js file is located at.
  
  More info: https://storybook.js.org/docs/configure
  
  at validateConfigurationFiles (node_modules/.pnpm/@storybook+core@8.3.5/node_modules/@storybook/core/dist/common/index.js:139226:11)

@tobiasdiez
Copy link
Collaborator

"@storybook-vue/nuxt": "0.2.6",

remove this

@jadurani
Copy link

jadurani commented Oct 5, 2024

"@storybook-vue/nuxt": "0.2.6",

remove this

hello @tobiasdiez, encountering the same issue The entry point "vue" cannot be marked as external and removing "@storybook-vue/nuxt": "0.2.6" results in a broken build:

> storybook dev --port 6006

@storybook/core v8.3.5

SB_CORE-COMMON_0003 (CouldNotEvaluateFrameworkError): Could not evaluate the '@storybook-vue/nuxt' package from the 'framework' field of Storybook config.

Are you sure it's a valid package and is installed?

More info: 

    at validateFrameworkName (./node_modules/@storybook/core/dist/common/index.cjs:143382:13)
    at buildDevStandalone (./node_modules/@storybook/core/dist/core-server/index.cjs:48463:51)
    at async withTelemetry (./node_modules/@storybook/core/dist/core-server/index.cjs:47080:12)
    at async dev (./node_modules/@storybook/core/dist/cli/bin/index.cjs:2877:3)
    at async r.<anonymous> (./node_modules/@storybook/core/dist/cli/bin/index.cjs:2929:74)

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

? Would you like to help improve Storybook by sending anonymous crash reports? › (Y/n)

@tobiasdiez
Copy link
Collaborator

@jadurani
Copy link

jadurani commented Oct 7, 2024

Do you use the same code as in https://github.com/nuxt-modules/storybook/tree/main/examples/starter ?

Ok~ that worked! (with additional steps, shown below)

I used that starter and encountered the following error on npm run storybook:

Image

Dug a bit more and found a workaround here: #776 (comment)

After adding the following in my nuxt.config.ts, it worked

  vite: {
    optimizeDeps: {
      include: ['jsdoc-type-pratt-parser']
    }
  }

Based on the thread above, the latest working config is in v8.3.0

@tillsanders
Copy link

The workaround @jadurani describes works for me, too. However, I now experience problems loading Vue components.

[plugin:vite:vue] At least one <template> or <script> is required in a single file component.

I have a feeling this might be happening because I'm using storybook in a Nuxt module, not a Nuxt project / site. So this might be unrelated to this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests