Webpack-bundle-analyzer: Error parsing bundle asset "*" no such file when mixing relative paths

Created on 12 Oct 2018  路  10Comments  路  Source: webpack-contrib/webpack-bundle-analyzer

Error parsing bundle asset "*" no such file when mixing relative paths

Looks like mixing paths for output stats.json and webpack entries causes this error.

Technical info

  • Webpack Bundle Analyzer version: 3.0.2
  • Webpack version: 4.6.15
  • Node.js version: 10.11.0
  • npm/yarn version: 6.4.1
  • OS: Archlinux

Debug info

Bundle analyzer is launched as npm script:
webpack --profile --json > dist/stats.json && webpack-bundle-analyzer dist/stats.json

And webpack entries look like that:

    entry: {
        'otherplace/bundle1': ['*', '*'],
        'otherplace/bundle2': '*',
        'otherplace/bundle3': '*',
        'dist/bundle4': '.*',
        'dist/bundle5': '.*',
    },

So, when
webpack --profile --json > dist/stats.json && webpack-bundle-analyzer dist/stats.json
Errors like

Error parsing bundle asset "<absolute path>/dist/dist/bundle5.js": no such file (/dist/ appear twice)
Error parsing bundle asset "<absolute path>/dist/otherplace/bundle2": no such file (should be no /dist/, only /otherplace/)

appear, and no parsed size (only stat size) available, but when using
webpack --profile --json > stats.json && webpack-bundle-analyzer stats.json
everything works fine

Needs triage Bug

Most helpful comment

A possible workaround to make it work, in case you have an output directory named dist:

webpack --profile --json > stats.json && webpack-bundle-analyzer stats.json dist/

All 10 comments

What does * mean in the paths?

What does * mean in the paths?

I just replaced the actual paths in the project

Probably there is something with joining paths from here: https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/master/src/analyzer.js#L50

I can create small demo project for this issue, if you want

I can create small demo project for this issue, if you want

Yes, it would help a lot.

@th0r:
https://github.com/Solant/bundle-analyzer-paths
npm run analyze:fine is intended behavior
npm run analyze:error shows described error

same issue here. local macos builds fine, and remote CI produces this error saying:

Child mini-css-extract-plugin node_modules/css-loader/index.js!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/sass-loader/lib/loader.js!node_modules/vue-loader/lib/index.js??vue-loader-options!src/views/Video.page.vue?vue&type=style&index=0&id=01422a34&scoped=true&lang=css&:
    Entrypoint mini-css-extract-plugin = *
    [0] ./node_modules/css-loader!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib??vue-loader-options!./src/views/Video.page.vue?vue&type=style&index=0&id=01422a34&scoped=true&lang=css& 162 bytes {0} [built]
        + 1 hidden module
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/vendors.cb3f9722098fcd2c8907.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/1.c26fe07aa377bd74cdf2.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/app.e5b23854adf630ec7091.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/3.902eabc18fbeb40958b0.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/4.e7e88988441cd90f96ea.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/5.706427295ce3457d8589.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/6.adf191adef5bc477f936.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/7.83db1aa0a0f4751e3f03.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/8.8dd0451db14c6295a8db.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/9.39df996a12dec23833f6.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/10.bdb90602a0cd2b799d62.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/11.7dd6ec8635d6f9a72611.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/12.fc237f1f81c92dc8330f.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/13.a377c93a2452a355bb3f.js": no such file
Error parsing bundle asset "/builds/xxxxxx/backend/resources/dist/assets/js/runtime.9b6506fc815dcb500655.js": no such file

webpack version not locked using "webpack": "^4.16.5",

the same problem with me.

it is normal when build on mac os, but linux makes errors.

this is my package version

    "webpack": "^4.38.0",
    "webpack-bundle-analyzer": "^3.4.1",
    "webpack-cli": "^3.3.6",

Same thing here, any thoughts?

A possible workaround to make it work, in case you have an output directory named dist:

webpack --profile --json > stats.json && webpack-bundle-analyzer stats.json dist/

@Solant thank you! But didn't help. In the end we've resolved it by adding second build, since it's always building OK on the second time in CI. First build is allowed to fail.

Was this page helpful?
0 / 5 - 0 ratings