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

If you use the nuxt/icon module Build fails when the development server is on. #354

Open
devmini1203 opened this issue Feb 11, 2025 · 6 comments

Comments

@devmini1203
Copy link

package manager : yarn
nuxt version : 3.13.2
@nuxt/icon version : latest
ide : vscode
ssr : false

Currently, I am developing a project with nuxt ssr false.
I need an icon, I installed @nuxt/icon and was developing it without any problems, and I found a problem with the build result not being produced when I proceeded with the generate command.

The error is as follows.

ERROR The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file:///_entry.js'

at createRequire (node:internal/modules/cjs/loader:1514:13)

The argument 'filename' must be a file URL object, file URL string, or ab

solute path string. Received 'file:///_entry.js'

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I'm curious about what the problem is. I've done a lot of tests

I found that the error occurred in the following case.

At the terminal of the vscode, first, run the development server using the yarn local.
yarn local => nuxt dev --port 3004 --dotenv .env.local
After that, open another terminal to perform the yarn generator:test.
yarn generate:test => yarn postinstall && nuxt generate --dotenv .env.test
This will not finish the build and will fail the build with the error message described above.

Shut down the development server terminal and use the generate command to build well without errors. :(

Of course, you can shut down the development server and generate it, but I decide that I can't shut down the development server, build it, and turn on the development server again, so I leave the issue like this.

I want to use this great module to complete the development.
I'd appreciate it if someone could help me.

Image

Image

Copy link

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have a couple of templates for starting with a minimal reproduction:

👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox

A public GitHub repository is also perfect. 👌

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

@danielroe danielroe transferred this issue from nuxt/nuxt Feb 11, 2025
@devmini1203
Copy link
Author

devmini1203 commented Feb 12, 2025

복제본 을 제공해 주실 수 있나요 ? 🙏

더 많은 정보

왜 복제본을 제출해야 합니까?

복제를 통해 비교적 작은 팀으로 문제를 신속하게 분류하고 해결할 수 있습니다. 이를 통해 문제의 근원을 발견하는 데 도움이 되며, 귀하 또는 당사가 내릴 수 있는 가정을 밝힐 수도 있습니다.

무슨 일이 일어날까요?

재현본을 제공하신 경우, 라벨을 제거하고 문제를 재현해 보겠습니다. 재현이 가능하다면 버그로 표시하고 심각도와 영향을 미칠 수 있는 사람의 수에 따라 우선순위를 정합니다.

레이블이 붙은 이슈가 실질적인 활동을 받지 못하면 needs reproduction(예: 재생산 링크가 있는 새로운 댓글) 우리는 그것을 닫을 것입니다. 그것은 우리가 신경 쓰지 않기 때문이 아닙니다! 언제든지 재생산으로 댓글을 달면 우리가 다시 열 것입니다.

어떻게 복제품을 만들 수 있나요?

우리는 최소한의 재생산으로 시작하기 위한 몇 가지 템플릿을 가지고 있습니다:

👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz 👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox

공개 GitHub 저장소도 완벽해요. 👌

가능한 한 복제를 최소화하십시오 **. 자세한 내용은 **가이드에서 확인하세요 .

다음의 다른 기사도 흥미롭고/또는 도움이 될 수 있습니다.

Hello, thank you for your hard work.

I've created an example project where my GitHub repository is experiencing errors.

The link is as below.

https://github.com/devmini1203/nuxt-icon-generate-error-example

As I've explained before

  1. Run the development server with the yarn local command at the first terminal.
  2. Run the build with the yarn generate command on the second terminal.

There are precautions.
Please proceed with the generate command after the development server is turned on for sure.

If an error like mine occurs after testing, I would appreciate it if you could answer it.

Thank you always.

@desk-pro
Copy link

desk-pro commented Feb 24, 2025

We observe a similar bug here.

When I build with npm run build -- --preset=firebase :
If the development server is running, , then the bundle size is ~5Mo. When I try to deploy to Firebase hosting, I get the same error as @devmini1203 -> ERROR The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file:///_entry.js'
If the development server is not running, the bundle size is ~8Mo. The difference I noticed is that the 8Mo bundle contains icons related files, which are missing in the 5Mo bundle :

├─ .output/server/chunks/_/icons.mjs (985 kB) (253 kB gzip)
├─ .output/server/chunks/_/icons.mjs.map (7.36 kB) (119 B gzip)
├─ .output/server/chunks/_/icons2.mjs (616 kB) (130 kB gzip)
├─ .output/server/chunks/_/icons2.mjs.map (5.28 kB) (117 B gzip)
├─ .output/server/chunks/_/icons3.mjs (7.25 MB) (2.67 MB gzip)
├─ .output/server/chunks/_/icons3.mjs.map (8.74 kB) (121 B gzip)
├─ .output/server/chunks/_/icons4.mjs (893 kB) (221 kB gzip)
├─ .output/server/chunks/_/icons4.mjs.map (8.83 kB) (122 B gzip)
├─ .output/server/chunks/_/icons5.mjs (1.87 MB) (293 kB gzip)
├─ .output/server/chunks/_/icons5.mjs.map (17.7 kB) (131 B gzip)

Thanks @devmini1203 for the tests !

@devmini1203
Copy link
Author

여기서도 비슷한 버그를 볼 수 있습니다.

: 로 빌드할 때 npm run build -- --preset=firebase: 개발 서버가 실행 중이면 번들 크기는 ~5Mo입니다. Firebase 호스팅에 배포하려고 하면 다음과 같은 오류가 발생합니다.@devmini1203-> ERROR The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file:///_entry.js' 개발 서버가 실행 중이 아니면 번들 크기는 ~8Mo입니다. 제가 알아차린 차이점은 8Mo 번들에 5Mo 번들에 없는 아이콘 관련 파일이 들어 있다는 것입니다.

├─ .output/server/chunks/_/icons.mjs (985 kB) (253 kB gzip)
├─ .output/server/chunks/_/icons.mjs.map (7.36 kB) (119 B gzip)
├─ .output/server/chunks/_/icons2.mjs (616 kB) (130 kB gzip)
├─ .output/server/chunks/_/icons2.mjs.map (5.28 kB) (117 B gzip)
├─ .output/server/chunks/_/icons3.mjs (7.25 MB) (2.67 MB gzip)
├─ .output/server/chunks/_/icons3.mjs.map (8.74 kB) (121 B gzip)
├─ .output/server/chunks/_/icons4.mjs (893 kB) (221 kB gzip)
├─ .output/server/chunks/_/icons4.mjs.map (8.83 kB) (122 B gzip)
├─ .output/server/chunks/_/icons5.mjs (1.87 MB) (293 kB gzip)
├─ .output/server/chunks/_/icons5.mjs.map (17.7 kB) (131 B gzip)

감사해요@devmini1203테스트를 위해서요!

@desk-pro

Hello, thank you so much for sharing regarding the error I am experiencing.
It hasn't been resolved yet..

@xushnudbek20
Copy link

I get the same errorImage

@devmini1203
Copy link
Author

I get the same errorImage

Hello, ID Xushnudbeck20
Thank you for sharing the same error as me so that faster feedback can come.

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

3 participants