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

Updated the rootPath to the working directory of the node process. #1719

Merged
merged 1 commit into from
Nov 27, 2018
Merged

Updated the rootPath to the working directory of the node process. #1719

merged 1 commit into from
Nov 27, 2018

Conversation

stephan-v
Copy link
Contributor

Currently laravel-mix breaks when your node_modules directory is a symlink. This is due to the fact that relatives paths don't work when you are using a symlink because they will not point to your project root but will rather move relative to where your symlinked files are located.

A symlinked node_modules directory is pretty common when using a project with continuous integration where you are building on a production server. Examples of this are codeship or envoyer. When you are symlinking your node_modules directory you are not forced to rebuild it for every deploy which saves a lot of time and resources.

The documentation on process.cwd():

https://nodejs.org/docs/latest/api/process.html#process_process_cwd

This should help fix:

#533
#650
#664

With this update the relative paths are completely removed and symlinks work perfectly fine.

I would love to get more input from more experience Node.js users on this request to see if this can lead to any potential drawbacks.

Currently laravel-mix breaks when your `node_modules` directory is a symlink. This is due to the fact that relatives paths don't work when you are using a symlink because they will not point to your project root but will rather move relative to where your symlinked files are located.

A symlinked `node_modules` directory is pretty common when using a project with continuous integration where you are building on a production server. Examples of this are codeship or envoyer. When you are symlinking your `node_modules` directory you are not forced to rebuild it for every deploy which saves a lot of time and resources.

The documentation on process.cwd():

https://nodejs.org/docs/latest/api/process.html#process_process_cwd

This should help fix:

#533
#650
#664

With this update the relative paths are completely removed and symlinks work perfectly fine.

I would love to get more input from more experience Node.js users on this request to see if this can lead to any potential drawbacks.
@repat
Copy link

repat commented Jul 25, 2018

This worked for me, could you please have a look @JeffreyWay :-) Thanks!

@dmfj
Copy link

dmfj commented Sep 18, 2018

This worked well for me, saves a lot of time in my deployment process.
Could you take a look please, @JeffreyWay 🙂

@JeffreyWay
Copy link
Collaborator

Thanks, @stephan-v! Merging this now.

(Sorry for the long wait. Had to put Mix on hold in order to finish up the Laracasts refresh. We'll tag a new release soon.)

@JeffreyWay JeffreyWay merged commit 868cb3b into laravel-mix:master Nov 27, 2018
@bolechen
Copy link

Can fixed for v2.* version? Laravel default include v2.* version.

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

Successfully merging this pull request may close these issues.

5 participants