-
Notifications
You must be signed in to change notification settings - Fork 824
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
[1.x] Added js directory path alias #328
Conversation
stubs/webpack.mix.js
Outdated
.webpackConfig({ | ||
resolve: { | ||
alias: { | ||
'@': path.resolve(__dirname, 'resources/js/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be shortened to:
'@': path.resolve('resources/js'),
(That's what I've always done.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested, it works 👍
Pushed the update.
I personally do really like this, but I do have two concerns:
Regarding the file being shared, I already mentioned this earlier today on this issue, so splitting it might be the way forward anyway. |
Additionally, it might make more sense to target v2 ( |
@claudiodekker This update haven't any breaking changes and doesn't force you to use alias. P.S. I have successfully setup alias resolving in VSCode and PHPStrom |
@claudiodekker the changes are only done to the stubs so it doesn't matter really. This would only apply to new apps. It's also nbd to update the new Inertia views of v2 so that's fine 🙂 |
Maybe we should break out the webpack stubs to be different for Inertia vs. Livewire? Also, any more thoughts on the PHP Storm issue? I don't use PHP Storm so can't really comment on that. |
Root directory alias might be useful for both presets. PHPStorm supports webpack.config detection with alias resolving. |
@slavarazum Yes, that applies to One way around it that I linked earlier is to create a |
@claudiodekker @slavarazum where do we go from here? We probably need to solve this PHP Storm issue that @claudiodekker is raising. |
@taylorotwell Let me export webpack config to separate file as @claudiodekker described. |
With
@
alias for js folder, we can use absoulte path instead of relative.Imports will be more clear:
Its standard practice from vue cli preset. Also, you can check out article https://laravel-news.com/laravel-mix-alias with example of implementation.