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

Move runtime merger.js to relative path #915

Open
1 of 2 tasks
ThomasBerneHCSE opened this issue Nov 20, 2024 · 17 comments · May be fixed by #922
Open
1 of 2 tasks

Move runtime merger.js to relative path #915

ThomasBerneHCSE opened this issue Nov 20, 2024 · 17 comments · May be fixed by #922
Labels
enhancement New feature or request

Comments

@ThomasBerneHCSE
Copy link

Describe the feature

I use a docker container to run a nuxt project with tailwindcss in local in dev mode. When I try to work on my machine it doesn't find the same absolute path to the runtime merger.js in .nuxt/tailwindcss.config.cjs :

Image

The absolute path is different between my machine and the container.

Can we change it to relative path please ?

Image

Here is the error I get:
Image

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?
@ThomasBerneHCSE ThomasBerneHCSE added the enhancement New feature or request label Nov 20, 2024
@ineshbose
Copy link
Collaborator

ineshbose commented Nov 20, 2024

I wonder if this could cause issues for PNPM without shamefully-hoist..

Is your Nuxt server/project properly configured to your Docker, or would some commands be running locally (sorry, admittedly my knowledge of Docker is a bit limited atm 😅)?

@ThomasBerneHCSE
Copy link
Author

ThomasBerneHCSE commented Nov 21, 2024

The path would be the same inside the node modules. That is just the way to access node modules I want to change. The problem would be the same with pnpm.

@ThomasBerneHCSE
Copy link
Author

@ineshbose is my explaination ok for you?

@ineshbose
Copy link
Collaborator

Yes - explanation is OK, it's just that the relative path for non-shamefully-hoisted could be quite odd and possibly unreliable. I think I should just provide the merger as an entry point within the package (something I wasn't able to do earlier, but let me retry now), so that it will only just be @nuxtjs/tailwindcss/merger

@ThomasBerneHCSE
Copy link
Author

That would be awesome! Thank you 👍

@ThomasBerneHCSE
Copy link
Author

@ineshbose I'm sorry to bother you again but did you managed to fix this issue? This is the only issue we have to work with docker here. Thanks again for your help and for that awesome module you built! 💯

@ineshbose
Copy link
Collaborator

Hey @ThomasBerneHCSE

I'm looking to merge #913 first and then I should create a PR for this. Meanwhile, if you want a workaround, you can use tailwindcss.disableHMR: true for the module options in your nuxt.config.

@ineshbose ineshbose linked a pull request Nov 27, 2024 that will close this issue
6 tasks
@sandros94
Copy link

@ThomasBerneHCSE I'm joining the discussion, since this triggered my curiosity but also this, to me, sounds more like a docker config issue rather than a module one (HMR should work/break for everything, not only for this module).

Could I ask you to go a bit in-depth in your current setup/config (OS, docker volume, dev container configs and so on)?

@ThomasBerneHCSE
Copy link
Author

@sandros94 This mustn't be a docker config issue. The path of the project inside the container is different of the path on my machine and the merge uses absolute paths. Meaning the IDE on the machine tries to locale files with absolute path as the container.

Project path inside container /usr/src.
Project path on the machine /home/user/Documents/project_name.

The IDE doesn't understand why /usr/src/{path_to_merge.js} doesn't exists on the machine.

Every other paths are relatives to the project and have 0 issues.

@sandros94
Copy link

Don't get me wrong, the PR will definitely help with this very issue.

I would like to see a reproduction mainly to be sure it is about bind mount configuration and not something different that might leak into production.

Usually when you start a dev container the IDE is aware of it and should take its paths into account, unless it is a bind mount and the processes are separate

@ineshbose
Copy link
Collaborator

Every other paths are relatives to the project and have 0 issues.

Is this for dependency imports in the buildDir? If you could give me an example, I could try and see how that template may be generated/resolved for reference.

Also a bit minor, but could you give nightly version a try as the resolver was moved out of the template?

@ThomasBerneHCSE
Copy link
Author

Is this for dependency imports in the buildDir?
=> Not only for dependencies but for every imports. Like components for example :

Image

But for exports from the node_modules, nuxt does it with it's own components :
Image

I'll try out the nightly version in a couple of hours.

@ThomasBerneHCSE
Copy link
Author

ThomasBerneHCSE commented Dec 3, 2024

Another workaround would be to add the .nuxt/tailwind.config.cjs to the .dockerignore. The volume wouldn't bind them. But there wouldn't be any update on the IDE of the state of tailwindcss.

@ineshbose
Copy link
Collaborator

Another workaround would be to add the .nuxt/tailwind.config.cjs to the .gitignore. The volume wouldn't bind them. But there wouldn't be any update on the IDE of the state of tailwindcss.

Wouldn't the .nuxt directory already be in .gitignore?

@ThomasBerneHCSE
Copy link
Author

No because in that case I couldn't have intellisence in the IDE.

@ThomasBerneHCSE
Copy link
Author

ThomasBerneHCSE commented Dec 3, 2024

Oh sorry. I wanted to say .dockerignore and not .gitignore. (I edited my message)

@flavionobredev
Copy link

same for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants