philicevic / mix-html-builder

A quick laravel mix extension to build up html templates from partials and layouts.
MIT License
19 stars 8 forks source link

prepend slash "/" in js path when inject #47

Open sashsvamir opened 3 years ago

sashsvamir commented 3 years ago

i have follow mix config:

mix
.setPublicPath('./public')
.html({
        htmlRoot: './src/index.html',
        output: './',
        inject: true,
        versioning: true,
}) 
.js('src/js/app.js', 'public/js')
.sass('src/sass/app.sass', 'public/css')
.version()

this leads to different paths of js and css in output html:

<script defer="defer" src="/js/app.js?086b3862766dbb627cdd">
<link href="css/app.css?086b3862766dbb627cdd" rel="stylesheet">

i'm expect to js path will be with no prepended slash "/". Like css path.

sashsvamir commented 3 years ago

Now i'm fix this with follow code, but may be exist more better way to fix this problem:

mix
.webpackConfig({
        output: {
            // fix prepend slash (/) in js bundle path in mix-html-builder
            publicPath: './'
        },
})