-
Notifications
You must be signed in to change notification settings - Fork 809
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
Chunk loading broken due to wrong publicPath #863
Comments
Same issue here. Ended up doing |
Any updates on this? When I run "npm run dev" it still looks for the chunks in the wrong folder (using 1.1.1 now). Cheers! |
Ah, I'm running into the same issues here. Been fiddling around with this for a while now. Happy to see it's a Laravel Mix issue actually! |
I opted to use
|
Bumping this as it's still an issue even with 1.6.0. I'm unable to make automated releases because the path is still relative to the current page (searching for chunks in |
Just a follow up as it seems to have been fixed for a hot reloading environment, but not in a production (tried with 2.0.0) as can be seen here. To fix this either use @spacemudd's solution, or the following if you still want to retain the HMR-functionality: const http = process.argv.includes('--https') ? 'https' : 'http';
mix.webpackConfig({
output: {
publicPath: Mix.isUsing('hmr')
? http + '://' + Config.hmrOptions.host + ':' + Config.hmrOptions.port + '/'
: '/', // <--- This slash is the fix here
},
}); @JeffreyWay Should I provide a PR for this? |
@spaceemotion I just tried the config in your last comment and it works perfectly for both the Please go ahead and make a PR, please merge it when they do @JeffreyWay |
@raniesantos I'd rather add that as a separate PR, but I'll wait for the new webpack 4 / component based system before opening a PR at all. Looks like it's right around the corner. |
@raniesantos already noticed, will try to work on this as soon i got the time :) |
Maybe stupid for commenting on an old issue... but IT SEEMS TO BE BROKEN AGAIN IN LARAVEL MIX 6... so... my next point on the agenda? REMOVE Laravel Mix... I am done with it... |
Description:
In #209 the webpack public path got changed from './' to just an empty string. As I just recently started to use chunk splitting, i never noticed this before until I wanted to update the main server today as I am using HMR on my local machine.
The issue seems to be that I'm either neither able to set the public path directly, nor the global.entry.base.
The fix is to just set the publicPath '/' as default again (https://github.com/JeffreyWay/laravel-mix/blob/v0.12.1/src/Mix.js#L69):
The URLs requested in the browser look like the following:
my-site.com/som/sub/js/6.(hash).js
my-site.com/js/6.(hash).js
I'm not sure if versioning the files has to do anything with this.Edit: It doesn't.
Steps To Reproduce:
Vue.component('test', r => require(['./test.vue'], r))
npm run dev
ornpm run production
The text was updated successfully, but these errors were encountered: