[vite-plugin-svelte-kit] Cannot read properties of undefined (reading 'paths') error during build
See original GitHub issueDescribe the bug
When running npm run build
this appears:
[vite-plugin-svelte-kit] Cannot read properties of undefined (reading 'paths') error during build
The cause is having a file with the same name and .js
and .ts
extensions in the same directory.
This took me three hours of my time to figure out, and I could not find a single answer anywhere online. I had to switch branches, stash, manually cut and paste hundreds of files, all because this error message was shown.
If we could instead show something along the lines of "Cannot have duplicate file names: {path/to/files}{filename} "
Reproduction
The cause is having a file with the same name and .js
and .ts
extensions in the same directory.
Logs
No response
System Info
Windows 10
Severity
annoyance
Additional Information
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:8
- Comments:23 (2 by maintainers)
Top Results From Across the Web
Cannot read properties of undefined (reading 'pathname')
I am getting the following text on the index page when deploying on production but when I run npm run build and npm...
Read more >TypeError: Cannot read properties of undefined (reading 'path ...
I am building a blog web app to post and edit using Node.js. It seems to work when I update an image and...
Read more >Uncaught typeerror: cannot read properties of undefined ...
Usually this means a variable that you're referencing has a value of undefined when you try to read the property (as the error...
Read more >IFS Cloud - Open Detail - Error - Problem with navigator
Found problem with transferring navigator path to Detail (maybe position of ... Error stack: Cannot read properties of undefined (reading ...
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
It seems like there a number of causes for this message, but basically it’s just hiding the details that were displayed properly extra-vite integration
As far as imports
import {someFunction} from 'someFile'
It gets that message if import
someFunction
is not exported insomeFile
It gets that message ifsomeFile
( or the path ) is not correct or missingOddly it won’t throw an error on build when
someFunction
is not insomeFile
There are other odd ones this error catches I have not been able to explain.
I believe I had a bad import path somewhere else that fixed it as well.