question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue
  • 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”

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ruchernchongcommented, Jun 5, 2017

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

0reactions
decadencecommented, Jun 5, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

{{ mix('js/bundle.js') }} prepending "/" to path #856 - GitHub
I use this to compile my vue component with HMR. <script src="{{ mix('js/bundle.js') }}"></script> It is normal when ...
Read more >
Laravel Mix - Han Wiki
ALWAYS use mix('js/app.js') to refer to assets managed via Laravel Mix in HTML/Blade files e.g. <script src="{{ mix('js/bundle.js') }} ...
Read more >
Hot Module Replacement | Laravel Mix Documentation
Hot Module Replacement (or Hot Reloading) allows you to, not just refresh the page when a piece of JavaScript is changed, but also...
Read more >
Vite How can I bundle all Javascript files in a single file like ...
mix ? When I run Vite Build it creates a file for each component. That said, what is the correct config to avoid...
Read more >
API - esbuild
The API can be accessed in one of three ways: on the command line, in JavaScript, and in Go. The concepts and parameters...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found