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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Project Root Directory in watch mode #7145

Closed
sergey-shpak opened this issue Oct 20, 2021 · 3 comments
Closed

Wrong Project Root Directory in watch mode #7145

sergey-shpak opened this issue Oct 20, 2021 · 3 comments

Comments

@sergey-shpak
Copy link
Contributor

馃悰 bug report

Configuring targets in package.json and running parcel watch leads to wrong project root directory - as result the file watcher pointed to the system root (or any parent root with package.json) and watching all the possible files (which makes initial and future timeouts and limits to system file watchers).

馃帥 Configuration (.babelrc, package.json, cli command)

"targets": {
  "default": {
    "source": "./src/app/index.js"
   }
},
"scripts": {
  "watch": "parcel watch"
}

馃 Expected Behavior

Correct project root dir, and fast parcel watch

馃槸 Current Behavior

Huge(8-10 seconds) timeouts when starting parcel watch and wrong project root dir

馃拋 Possible Solution

I had to debug parcel, and the problem is quite simple - when running parcel watch it uses current working directory as an entry point, and since current directory path doesn't contain trailing slash it is ignored when trying to find project root directory (it walks only through the parents looking for package-lock.json), then wrong project root directory is used to listen to system file changes.

*tried to run parcel watch $PWD/ but still no luck, because entry point is resolved(by path) and trailing slash removed, which leads to the same bug

馃實 Your Environment

Node@16.9, Ubuntu 20.4, Parcel@2.0.0-rc.0

@akaltar
Copy link

akaltar commented Oct 28, 2021

This issue seems to persist on Parcel@2.0.0 and Windows, and it also breaks the logic to find .proxyrc.js.

@jdmota
Copy link

jdmota commented Dec 14, 2021

I believe I am having the same issue on Windows.

In my case, Parcel seems to be picking up the package-lock.json file in my user directory, even though I have yarn.lock and .git in my project folder, and because of that, it is setting the project root to be the user directory.

Edit: this seems to occur when I do not pass entries to the build command, and instead rely on the source config.

This explains why I was not seeing a .parcel-cache folder in my project but instead I found it in my user directory.

I also experienced what was already mentioned: Parcel watching more files than necessary, thus hanging when I hit ctrl+c; and the .proxyrc.js file not being found.

@mischnic
Copy link
Member

mischnic commented Jun 7, 2022

This was fixed by #7537

@mischnic mischnic closed this as completed Jun 7, 2022
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

4 participants