Laravel-mix: Cannot define output path for manifest.js when extracting vendor libraries

Created on 28 Jun 2018  路  5Comments  路  Source: JeffreyWay/laravel-mix

Description:

In my application I have two entry points (js/main.js, /js/appB/main.js) that share a common some-vendor-library and I want to extract it in a separate file.

The webpack.mix.js file:

mix.js('resources/assets/js/main.js', 'public/js/main.js');
mix.js('resources/assets/js/appB/main.js', 'public/js/appB/main.js');

mix.extract(['some-vendor-library'], 'public/js/vendor.js')

Running the code above, will result in successfully extracting the common vendor library into vendor.js and create the required manifest.js file.

However, although I can explicitly define the output path for vendor.js (i.e. 'public/js/vendor.js') , I cannot do the same with manifest.js. Specifically, manifest.js is located into the path defined by the last mix.js() call, that is public/js/appB/manifest.js in this particular case.

Is it possible to explicitly define a path for both vendor.js and manifest.js ?

IMHO it would also make sense the manifest.js to be automatically placed in the parent directory of vendor.js, as it is defined by the the mix.extract()

For instance, in case we call

mix.extract(['some-vendor-library'], 'public/js/some-directory/vendor.js')

, the manifest to be placed into the public/js/some-directory/ directory

stale

Most helpful comment

IMO the second parameter to the extract function should be the directory for both the vendor.js and manifest.js files. I.E. we should call it as:

mix.extract(['some-vendor-library'], 'public/js/some-directory');

I wouldn't think there would be many use cases where it would make sense to have manifest.js and vendor.js in different directories 馃槃

All 5 comments

IMO the second parameter to the extract function should be the directory for both the vendor.js and manifest.js files. I.E. we should call it as:

mix.extract(['some-vendor-library'], 'public/js/some-directory');

I wouldn't think there would be many use cases where it would make sense to have manifest.js and vendor.js in different directories 馃槃

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.

@iraklisg Did you solve it? I have the same problem.

@elliotleelewis I can not solve it your way.

Not stale. Bumb up..

We are also having this same issue. In our case, the last call to mix.ts (for TypeScript) will be the path that vendor.js & manifest.js will be compiled to.

"laravel-mix": "^5.0.1",

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amin101 picture amin101  路  3Comments

nezaboravi picture nezaboravi  路  3Comments

jpriceonline picture jpriceonline  路  3Comments

sdebacker picture sdebacker  路  3Comments

wendt88 picture wendt88  路  3Comments