Laravel-mix: Dynamic import ignores mix.setResourceRoot() path. New Issue, since #1513 is stale.

Created on 5 Sep 2019  路  6Comments  路  Source: JeffreyWay/laravel-mix

This is a continuation of issue #1513, since that was marked stale and closed.

As of Laravel Mix v4.1.2, setResourceRoot is ignored. This means applications require major hacks to use lazy component loading.

stale

Most helpful comment

There is at least a partial fix by doing the following:

mix.webpackConfig({
    output: {
        publicPath: '<same url as setResourceRoot>',
    },
});

Which gets around the issue of the JavaScript not loading at all.

There is still an issue of mix.sass('resources/sass/app.scss', 'css') outputting a 0 byte file when I use lazy loading, but the Vue component at least renders. I will probably open a separate issue on that one tomorrow.

All 6 comments

There is at least a partial fix by doing the following:

mix.webpackConfig({
    output: {
        publicPath: '<same url as setResourceRoot>',
    },
});

Which gets around the issue of the JavaScript not loading at all.

There is still an issue of mix.sass('resources/sass/app.scss', 'css') outputting a 0 byte file when I use lazy loading, but the Vue component at least renders. I will probably open a separate issue on that one tomorrow.

see https://github.com/JeffreyWay/laravel-mix/issues/863#issuecomment-324332719
it resolved my issue, without .extract

I don't think this is only related to dynamic imports. I have no dynamic imports at all and setResourceRoot() is completely ignored

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Hello, any updates on this issue?
I'd like to make use of dynamic imports but it seems setResourceRoot has no effect.

Not matter what I do, either in watch mode or production build, chunks are being loaded from the root of public path ( GET http://localhost:3000/vendors~vimeo.js net::ERR_ABORTED 404 (Not Found)).

Anyone has a workaround or should I use my own Webpack configuration?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hasnatbabur picture hasnatbabur  路  3Comments

Cheddam picture Cheddam  路  3Comments

jpriceonline picture jpriceonline  路  3Comments

rderimay picture rderimay  路  3Comments

stefensuhat picture stefensuhat  路  3Comments