Laravel-mix: manifest.js is not created in the same folder as vendor.js

Created on 16 Aug 2017  路  14Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 1.4.2
  • Node Version (node -v): v6.10.3
  • NPM Version (npm -v): 3.10.10
  • OS: OSX

Description:

After upgrading to Laravel Mix 1.4.2 from 0.11.4, manifest.js is not created in the same folder as vendor.js. Instead, manifest.js was added to the folder where a javascript is built by js() function.

Steps To Reproduce:

webpack.mix.js:

mix.setPublicPath('app/public')
    .js('asset/js/test/test.js', 'js/test')
    .extract(['vue'], 'js/vendor.js');

webpack output:

       /js/vendor.js   82.4 kB       0  [emitted]  /js/vendor
    /js/test/test.js  72 bytes       1  [emitted]  /js/test/test
/js/test/manifest.js   1.38 kB       2  [emitted]  /js/test/manifest

I believe it was /js/manifest.js instead of /js/test/manifest.js in Laravel Mix 0.11.4.

stale

Most helpful comment

This issue should be re-opened.

All 14 comments

I upgraded my Laravel Mix version to 1.5.1 today, and this issue reappared! I am the reporter of #553.

If that helps anyone, I reused my old workaround. The idea is to push a CommonsChunkPlugin config that will likely override the one setup by Mix. It seems like it has no effect on the vendor chunk

const myScriptBasePath = 'dist/core'; // this is where my manifest will output

mix.js('some/path/myEntry', 'dist/myOutput')
    .webpackConfig({
        plugins: [
            new webpack.optimize.CommonsChunkPlugin({
               name: path.join(myScriptBasePath, 'manifest'),
               minChunks: Infinity
            })
        ]
    })

This will output the manifest into the path defined by myScriptBasePath. It seems to work alright, while waiting for the issue to be fixed.

I found a workaround for this issue by creating an empty js file in js/empty.js and doing this:

mix.setPublicPath('app/public')
    .js('asset/js/test/test.js', 'js/test')
    .js('asset/js/empty.js', 'js')
    .extract(['vue']);

webpack output:

/js/test/test.js  72 bytes       1  [emitted]  /js/test/test
    /js/empty.js   5 bytes       1  [emitted]  /js/empty
   /js/vendor.js   82.4 kB       0  [emitted]  /js/vendor
 /js/manifest.js   1.38 kB       2  [emitted]  /js/manifest

@hafezdivandari Very Clever.. SUPERB

@JeffreyWay any update on this ?

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.

I don't think this has been fixed though?

I'm facing this issue now where the manifest is in a random directory rather than next to the vendor path specified in extract.

Yeah I'm facing this issue too in version 4. Would be nice to have a general fix for that. In the meantime I'll try @hafezdivandari idea.

This issue should be re-opened.

It is also happening to me.. using laravel-mix v4.0.14

This is still a problem

This is still a problem

I'm facing the same issue when .ts and .js are used together: manifest.js is placed alongside the .ts output

Example webpack.mix.js:

const mix = require('laravel-mix');

mix.ts('js/sub-apps/*.ts', 'public/js/sub-apps')
    .extract('public/js/vendor.js')
    .js('js/app.js', 'public/js');

Project tructure:

js/
  app.js
  sub-apps/
    foo.ts

Result:

public/
  js/
    sub-apps/
      foo.js
      manifest.js
    app.js
    vendor.js

Mix version is 5.0.0 (latest)

I would like to see this issue been resolved. Besides, from my point of view, it makes sense both manifest.js and vendor.js files to be extracted in the same directory

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nezaboravi picture nezaboravi  路  3Comments

Bomavi picture Bomavi  路  3Comments

dtheb picture dtheb  路  3Comments

rlewkowicz picture rlewkowicz  路  3Comments

amin101 picture amin101  路  3Comments