npm run build retrieves `The argument 'filename' must be a file URL object, file URL string, or absolute path string`
See original GitHub issueDescribe the bug
I’ve created a npm package that in development it works OK but when I run npm run build it retrieves the next error.
[vite-plugin-svelte] The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received '\x00__vite-browser-external?commonjs-proxy'
> The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received '\x00__vite-browser-external?commonjs-proxy'
Reproduction
This is the repo where this is happening.
https://github.com/silvestrevivo/solana-svelte-counter
I think it would be difficult to reproduce since you need to deploy the smart contract to run the project. With the SvelteKit version 251 this bug doesn’t occur. As soon as you upgrade SvelteKit, the error happens.
Logs
[vite-plugin-svelte] The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received '\x00__vite-browser-external?commonjs-proxy'
> The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received '\x00__vite-browser-external?commonjs-proxy'
at new NodeError (node:internal/errors:371:5)
at createRequire (node:internal/modules/cjs/loader:1210:13)
at resolveViaPackageJsonSvelte (file:///Users/silvestrevivo/werk/2021/solana/solana-svelte-counter/app/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:1427:26)
at Object.resolveId (file:///Users/silvestrevivo/werk/2021/solana/solana-svelte-counter/app/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:1585:24)
at /Users/silvestrevivo/werk/2021/solana/solana-svelte-counter/app/node_modules/rollup/dist/shared/rollup.js:22795:37
System Info
.
Severity
annoyance
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:18 (5 by maintainers)
Top Results From Across the Web
typescript - The argument 'filename' must be a file URL object ...
The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/eslintrc.cjs'.
Read more >7 Working with file system paths and file URLs on Node.js
Concatenates the paths and return a fully qualified path. It uses the following algorithm: Start with the current working directory. Resolve path[0] against...
Read more >TypeError: The argument 'filename' must be a file URL object
TypeError : The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received undefined.
Read more >URL | Node.js v19.3.0 Documentation
A URL string is a structured string containing multiple meaningful ... Gets the URLSearchParams object representing the query parameters of the URL.
Read more >lint-staged - npm
Run linters against staged git files and don't let slip into your ... argument string (default: 0) --no-stash disable the backup stash, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
try, catch has been removed around
resolveViaPackageJsonSveltefn. Adding try catch seems to solve the error. Downgrade to@sveltejs/vite-plugin-svelte@1.0.0-next.37to solve the issue for nowok created a new issue here https://github.com/sveltejs/vite-plugin-svelte/issues/340