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

build error: [vite-plugin-pwa:build] Failed to resolve entry for package "fs". #3

Open
waldenn opened this issue Jul 10, 2024 · 2 comments

Comments

@waldenn
Copy link

waldenn commented Jul 10, 2024

I tried to fix it with: "import fs from 'node:fs';" in "vite.config.ts", but it did not help. Any ideas how to fix this? Thanks!


`$ npm run build

ask-my-pdf@0.2.1 build
tsc && vite build

plugin 'html-plugin' uses deprecated 'enforce' option. Use 'order' option instead.
plugin 'html-plugin' uses deprecated 'transform' option. Use 'handler' option instead.
vite v5.2.11 building for production...
[plugin:vite:resolve] [plugin vite:resolve] Module "crypto" has been externalized for browser compatibility, imported by "/home/foo/dev/ask-my-pdf/node_modules/@nico-martin/tvmjs/lib/index.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] [plugin vite:resolve] Module "perf_hooks" has been externalized for browser compatibility, imported by "/home/foo/dev/ask-my-pdf/node_modules/@nico-martin/tvmjs/lib/index.js". See https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
✓ 79 modules transformed.
x Build failed in 1.31s
error during build:
Error: [vite-plugin-pwa:build] Failed to resolve entry for package "fs". The package may have incorrect main/module/exports specified in its package.json.
file: /home/foo/dev/ask-my-pdf/src/store/llm/LlmContextProvider.tsx
at packageEntryFailure (file:///home/foo/dev/ask-my-pdf/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:48264:17)
at resolvePackageEntry (file:///home/foo/dev/ask-my-pdf/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:48261:5)
at tryNodeResolve (file:///home/foo/dev/ask-my-pdf/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:48031:20)
at Object.resolveId (file:///home/foo/dev/ask-my-pdf/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:47781:28)
at file:///home/foo/dev/ask-my-pdf/node_modules/rollup/dist/es/shared/node-entry.js:19778:40
at async PluginDriver.hookFirstAndGetPlugin (file:///home/foo/dev/ask-my-pdf/node_modules/rollup/dist/es/shared/node-entry.js:19678:28)
at async resolveId (file:///home/foo/dev/ask-my-pdf/node_modules/rollup/dist/es/shared/node-entry.js:18359:26)
at async ModuleLoader.resolveId (file:///home/foo/dev/ask-my-pdf/node_modules/rollup/dist/es/shared/node-entry.js:18762:15)
at async file:///home/foo/dev/ask-my-pdf/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:8444:16
at async Promise.all (index 0)
`

@nico-martin
Copy link
Owner

Hi @waldenn, thanks for reaching out!
What OS and what version of Node are you using?

@waldenn
Copy link
Author

waldenn commented Jul 10, 2024

Hi @waldenn, thanks for reaching out! What OS and what version of Node are you using?

$ node -v
v20.14.0

$ cat lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"

$ uname -a
Linux yoga 6.5.0-41-generic #41~22.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun 3 11:32:55 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

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

2 participants