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

{{ mix('js/bundle.js') }} prepending "/" to path #856

Closed
ramakrishnamundru opened this issue Jun 5, 2017 · 7 comments
Closed

{{ mix('js/bundle.js') }} prepending "/" to path #856

ramakrishnamundru opened this issue Jun 5, 2017 · 7 comments

Comments

@ramakrishnamundru
Copy link

  • Laravel Mix Version: 0.12.1
  • Node Version (node -v): 7.10.0
  • NPM Version (npm -v): 4.2.0
  • OS: Linux-mint

Description:

I use this to compile my vue component with HMR.
<script src="{{ mix('js/bundle.js') }}"></script>
It is normal when used with npm run hot but when run npm run dev
is outputting
<script src="/js/bundle.js"></script>
I set the resource root like this
mix.setResourceRoot('/myapp/public/');

Because of the "/" the browser is looking for the file in the root directory of the server instead of "myapp"

@decadence
Copy link

decadence commented Jun 5, 2017

It's intended.

Look here.

@ramakrishnamundru
Copy link
Author

Hi,
Any workaround for this?

@decadence
Copy link

Maybe you could try call setPublicPath instead of setResourceRoot

@ramakrishnamundru
Copy link
Author

I am using
mix.setPublicPath('public')
But no use.

@JeffreyWay
Copy link
Collaborator

This repo doesn't control that function. So that would be a Laravel framework issue.

@ruchernchong
Copy link
Contributor

ruchernchong commented Jun 5, 2017

@ramakrishnamundru Workaround is using url(mix()) helper as per Taylor Otwell's suggestion.

@decadence
Copy link

@ruchern And how does that resolve forcing leading slash behaviour?

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