Laravel-mix: .js() stucking at 95% if public path is one level before the root

Created on 1 Sep 2017  路  4Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 1.4.2
  • Node Version (node -v): 6.11.2
  • NPM Version (npm -v): 3.10.10
  • OS: Windows 7
  • Laravel: 5.4

Description:

*sorry for the bad english

.js() is stucking at '95% emitting' if public path is one level before the Laravel root
I need a setup where compiled css and js folder are located one level before the Laravel root.

The folder root is 'C:\wwwrgb-project', and the struct is something like this:

  • /rgb-project/css (compiled css go here)
  • /rgb-project/js (compiled js go here)
  • /rgb-project/laravel
  • /rgb-project/laravel/public
  • /rgb-project/laravel/resources/assets/sass/
  • /rgb-project/laravel/resources/assets/js/

My /rgb-project/laravel/webpack.mix.js is pretty much vanilla, except for the .setPublicPath

let mix = require('laravel-mix');
mix.setPublicPath('../')
    .sass('resources/assets/sass/app.scss', 'css')
    .js('resources/assets/js/app.js', 'js');
  • If I run 'npm run dev', it will stuck at '95% emitting' state, CSS will be compiled correctly on the '/rgb-project/css' path, but nothing will happen to JS.
  • If I remove the .js() line it will run perfectly (without JS compiled, off course)
  • If I do not set the public path (everything vanilla) it will compile correctly at '/rgb-project/laravel/public', but I need it one level before the root

This is the 'mix-manifest.json' generated at '/rgb-project' when it stuck at 95%:

{
    "/C:/www/rgb-project/js/app.js": "/C:/www/rgb-project/js/app.js",
    "/css/app.css": "/css/app.css"
}

Steps To Reproduce:

  • Vanilla Laravel 5.4
  • Add ".setPublicPath('../')" to 'webpack.mix.js'
  • Compile

Most helpful comment

All 4 comments

I am having the same issue so i reverted to using the default structure of the public folder. Then just switching the structure for when I push to production. Would be a useful fix though :)

@TopFuel That fixed it. Thanks.

@TopFuel Thanks, that works, just a little observation:

path.normalize('../') Do not work
path.normalize('../.') Is working correctly

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mementoneli picture mementoneli  路  3Comments

kpilard picture kpilard  路  3Comments

RomainGoncalves picture RomainGoncalves  路  3Comments

terion-name picture terion-name  路  3Comments

sdebacker picture sdebacker  路  3Comments