Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whybundled needs "reasons" to function properly #10

Closed
kurtextrem opened this issue Mar 13, 2018 · 19 comments
Closed

Whybundled needs "reasons" to function properly #10

kurtextrem opened this issue Mar 13, 2018 · 19 comments
Labels
bug Something isn't working

Comments

@kurtextrem
Copy link

My stats.json contains a lot of reasons props, but I get the error

 ERROR  Stats file "stats.json" doesn't contain "reasons" why modules are included...
Whybundled needs "reasons" to function properly.

I'm on Windows 10.

Link to stats: https://kurtextrem.de/assets/stats.json

@d4rkr00t
Copy link
Owner

What version of webpack are you using? Seems like all of your chunks are wrapped in children array and whybundled doesn't expect that :(

@kurtextrem
Copy link
Author

Webpack v4.1.1

@d4rkr00t
Copy link
Owner

Thanks. I'll investigate that.

@d4rkr00t d4rkr00t added the bug Something isn't working label Mar 13, 2018
@eh-am
Copy link

eh-am commented May 2, 2019

Hmm I am having the same issue, using webpack 4.25.1 and angular cli 6.1.1

It sucks I can't publish the whole stats.json, this is the result of running cat dist/stats.json | jq '.["chunks"][]["modules"][1]' if it helps

null
null
null
{
  "id": "",
  "identifier": "css /project/node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!/project/node_modules/postcss-loader/lib/index.js??extracted!/project/node_modules/sass-loader/lib/loader.js??ref--14-3!/project/src/assets/scss/helpers.scss 0",
  "name": "css ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/lib??extracted!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/assets/scss/helpers.scss",
  "index": 1558,
  "index2": 1556,
  "size": 212,
  "built": false,
  "optional": false,
  "prefetched": false,
  "chunks": [
    2
  ],
  "issuer": "/project/node_modules/mini-css-extract-plugin/dist/loader.js!/project/node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!/project/node_modules/postcss-loader/lib/index.js??extracted!/project/node_modules/sass-loader/lib/loader.js??ref--14-3!/project/src/assets/scss/helpers.scss",
  "issuerId": "JYys",
  "issuerName": "./src/assets/scss/helpers.scss",
  "issuerPath": [
    {
      "id": 0,
      "identifier": "multi /project/src/styles.scss /project/src/assets/scss/helpers.scss /project/node_modules/material-icons/iconfont/material-icons.css",
      "name": "multi ./src/styles.scss ./src/assets/scss/helpers.scss ./node_modules/material-icons/iconfont/material-icons.css"
    },
    {
      "id": "JYys",
      "identifier": "/project/node_modules/mini-css-extract-plugin/dist/loader.js!/project/node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!/project/node_modules/postcss-loader/lib/index.js??extracted!/project/node_modules/sass-loader/lib/loader.js??ref--14-3!/project/src/assets/scss/helpers.scss",
      "name": "./src/assets/scss/helpers.scss"
    }
  ],
  "failed": false,
  "errors": 0,
  "warnings": 0,
  "assets": [],
  "reasons": [
    {
      "moduleId": "JYys",
      "moduleIdentifier": "/project/node_modules/mini-css-extract-plugin/dist/loader.js!/project/node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!/project/node_modules/postcss-loader/lib/index.js??extracted!/project/node_modules/sass-loader/lib/loader.js??ref--14-3!/project/src/assets/scss/helpers.scss",
      "module": "./src/assets/scss/helpers.scss",
      "moduleName": "./src/assets/scss/helpers.scss"
    }
  ],
  "usedExports": true,
  "providedExports": null,
  "optimizationBailout": [
    "ModuleConcatenation bailout: Module is not an ECMAScript module"
  ],
  "depth": 2
}
{
  "id": "0/R4",
  "identifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_is-object.js",
  "name": "./node_modules/core-js/modules/_is-object.js",
  "index": 1478,
  "index2": 1469,
  "size": 110,
  "cacheable": true,
  "built": true,
  "optional": false,
  "prefetched": false,
  "chunks": [
    3
  ],
  "issuer": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_validate-collection.js",
  "issuerId": "s5qY",
  "issuerName": "./node_modules/core-js/modules/_validate-collection.js",
  "issuerPath": [
    {
      "id": 1,
      "identifier": "multi /project/src/polyfills.ts",
      "name": "multi ./src/polyfills.ts"
    },
    {
      "id": "hN/g",
      "identifier": "/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--17-0!/project/node_modules/@ngtools/webpack/src/index.js!/project/src/polyfills.ts",
      "name": "./src/polyfills.ts"
    },
    {
      "id": "FZcq",
      "identifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/es7/reflect.js",
      "name": "./node_modules/core-js/es7/reflect.js"
    },
    {
      "id": "uAtd",
      "identifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/es7.reflect.get-metadata-keys.js",
      "name": "./node_modules/core-js/modules/es7.reflect.get-metadata-keys.js"
    },
    {
      "id": "T39b",
      "identifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/es6.set.js",
      "name": "./node_modules/core-js/modules/es6.set.js"
    },
    {
      "id": "s5qY",
      "identifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_validate-collection.js",
      "name": "./node_modules/core-js/modules/_validate-collection.js"
    }
  ],
  "failed": false,
  "errors": 0,
  "warnings": 0,
  "assets": [],
  "reasons": [
    {
      "moduleId": "s5qY",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_validate-collection.js",
      "module": "./node_modules/core-js/modules/_validate-collection.js",
      "moduleName": "./node_modules/core-js/modules/_validate-collection.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "1:15-38"
    },
    {
      "moduleId": "EK0E",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/es6.weak-map.js",
      "module": "./node_modules/core-js/modules/es6.weak-map.js",
      "moduleName": "./node_modules/core-js/modules/es6.weak-map.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "7:15-38"
    },
    {
      "moduleId": "Z6vF",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_meta.js",
      "module": "./node_modules/core-js/modules/_meta.js",
      "moduleName": "./node_modules/core-js/modules/_meta.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "2:15-38"
    },
    {
      "moduleId": "ZD67",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_collection-weak.js",
      "module": "./node_modules/core-js/modules/_collection-weak.js",
      "moduleName": "./node_modules/core-js/modules/_collection-weak.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "5:15-38"
    },
    {
      "moduleId": "y3w9",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_an-object.js",
      "module": "./node_modules/core-js/modules/_an-object.js",
      "moduleName": "./node_modules/core-js/modules/_an-object.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "1:15-38"
    },
    {
      "moduleId": "apmT",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_to-primitive.js",
      "module": "./node_modules/core-js/modules/_to-primitive.js",
      "moduleName": "./node_modules/core-js/modules/_to-primitive.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "2:15-38"
    },
    {
      "moduleId": "4LiD",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_collection.js",
      "module": "./node_modules/core-js/modules/_collection.js",
      "moduleName": "./node_modules/core-js/modules/_collection.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "9:15-38"
    },
    {
      "moduleId": "6FMO",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_array-species-constructor.js",
      "module": "./node_modules/core-js/modules/_array-species-constructor.js",
      "moduleName": "./node_modules/core-js/modules/_array-species-constructor.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "1:15-38"
    },
    {
      "moduleId": "Iw71",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_dom-create.js",
      "module": "./node_modules/core-js/modules/_dom-create.js",
      "moduleName": "./node_modules/core-js/modules/_dom-create.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "1:15-38"
    },
    {
      "moduleId": "Xbzi",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_inherit-if-required.js",
      "module": "./node_modules/core-js/modules/_inherit-if-required.js",
      "moduleName": "./node_modules/core-js/modules/_inherit-if-required.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "1:15-38"
    },
    {
      "moduleId": "i5dc",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/core-js/modules/_set-proto.js",
      "module": "./node_modules/core-js/modules/_set-proto.js",
      "moduleName": "./node_modules/core-js/modules/_set-proto.js",
      "type": "cjs require",
      "userRequest": "./_is-object",
      "loc": "3:15-38"
    }
  ],
  "usedExports": true,
  "providedExports": null,
  "optimizationBailout": [
    "ModuleConcatenation bailout: Module is not an ECMAScript module"
  ],
  "depth": 5,
  "source": "module.exports = function (it) {\n  return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n"
}
{
  "id": "+Ewk",
  "identifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/sockjs-client/lib/transport/jsonp-polling.js",
  "name": "./node_modules/sockjs-client/lib/transport/jsonp-polling.js",
  "index": 1129,
  "index2": 1123,
  "size": 1016,
  "cacheable": true,
  "built": true,
  "optional": false,
  "prefetched": false,
  "chunks": [
    4
  ],
  "issuer": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/sockjs-client/lib/transport-list.js",
  "issuerId": "aUWK",
  "issuerName": "./node_modules/sockjs-client/lib/transport-list.js",
  "issuerPath": [
    {
      "id": 5,
      "identifier": "multi /project/src/main.ts",
      "name": "multi ./src/main.ts"
    },
    {
      "id": null,
      "identifier": "/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--17-0!/project/node_modules/@ngtools/webpack/src/index.js!/project/src/main.ts",
      "name": "./src/main.ts"
    },
    {
      "id": null,
      "identifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--17-0!/project/node_modules/@ngtools/webpack/src/index.js!/project/src/app/app.module.ngfactory.js",
      "name": "./src/app/app.module.ngfactory.js"
    },
    {
      "id": null,
      "identifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--17-0!/project/node_modules/@ngtools/webpack/src/index.js!/project/src/app/gtl/shared-pages/loans/loans-details/loans-details.component.ngfactory.js",
      "name": "./src/app/gtl/shared-pages/loans/loans-details/loans-details.component.ngfactory.js"
    },
    {
      "id": null,
      "identifier": "/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--17-0!/project/node_modules/@ngtools/webpack/src/index.js!/project/src/app/gtl/core/services/websocket/loan-websocket.service.ts",
      "name": "./src/app/gtl/core/services/websocket/loan-websocket.service.ts"
    },
    {
      "id": "zH15",
      "identifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/sockjs-client/lib/entry.js",
      "name": "./node_modules/sockjs-client/lib/entry.js"
    },
    {
      "id": "aUWK",
      "identifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/sockjs-client/lib/transport-list.js",
      "name": "./node_modules/sockjs-client/lib/transport-list.js"
    }
  ],
  "failed": false,
  "errors": 0,
  "warnings": 0,
  "assets": [],
  "reasons": [
    {
      "moduleId": "aUWK",
      "moduleIdentifier": "/project/node_modules/cache-loader/dist/cjs.js??ref--8-0!/project/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/project/node_modules/sockjs-client/lib/transport-list.js",
      "module": "./node_modules/sockjs-client/lib/transport-list.js",
      "moduleName": "./node_modules/sockjs-client/lib/transport-list.js",
      "type": "cjs require",
      "userRequest": "./transport/jsonp-polling",
      "loc": "17:2-38"
    }
  ],
  "usedExports": true,
  "providedExports": null,
  "optimizationBailout": [
    "ModuleConcatenation bailout: Module is not an ECMAScript module"
  ],
  "depth": 6,
  "source": "'use strict';\n\n// The simplest and most robust transport, using the well-know cross\n// domain hack - JSONP. This transport is quite inefficient - one\n// message could use up to one http request. But at least it works almost\n// everywhere.\n// Known limitations:\n//   o you will get a spinning cursor\n//   o for Konqueror a dumb timer is needed to detect errors\n\nvar inherits = require('inherits')\n  , SenderReceiver = require('./lib/sender-receiver')\n  , JsonpReceiver = require('./receiver/jsonp')\n  , jsonpSender = require('./sender/jsonp')\n  ;\n\nfunction JsonPTransport(transUrl) {\n  if (!JsonPTransport.enabled()) {\n    throw new Error('Transport created when disabled');\n  }\n  SenderReceiver.call(this, transUrl, '/jsonp', jsonpSender, JsonpReceiver);\n}\n\ninherits(JsonPTransport, SenderReceiver);\n\nJsonPTransport.enabled = function() {\n  return !!global.document;\n};\n\nJsonPTransport.transportName = 'jsonp-polling';\nJsonPTransport.roundTrips = 1;\nJsonPTransport.needBody = true;\n\nmodule.exports = JsonPTransport;\n"
}

@vanslly
Copy link

vanslly commented Jun 17, 2019

@d4rkr00t Why was this one closed? Lots of folks using webpack 4; it's what is used with angular cli. My stats files are too large for an editor - so really hoping you can fix this for us.

@d4rkr00t
Copy link
Owner

It's closed because I thought i fixed it, if you see it's still happening, can you provide more info about it?

@vanslly
Copy link

vanslly commented Jun 17, 2019

For my angular app running ng build --stats-json --prod --aot --verbose generates a stats.json file with reasons in them: reasons":[{"moduleId":null,"moduleIdentifier":"... however I get this from npx whybundled dist/{app-name}/stats.json:

ERROR Stats file "dist/{app-name}/stats.json" doesn't contain "reasons" why modules are included...

I think none of this is actually helpful since I don't have a minimal working example.

@d4rkr00t
Copy link
Owner

Can you please open your stats.json and see are there "reasons" in it?

@vanslly
Copy link

vanslly commented Jun 17, 2019

Yes there are, that's what I am saying. My stats.json file has "reasons" in it.

@vanslly
Copy link

vanslly commented Jun 17, 2019

I've given this ago with a vanilla angular 7 app and I get the same result.
Finally a somewhat minimal working example.

Steps:

  1. npm i -g @angular/cli@7.3.8
  2. ng new my-app
  3. cd my-app
  4. ng build --stats-json --prod --aot --verbose
  5. npx whybundled dist/my-app/stats.json

ERROR Stats file "stats.json" doesn't contain "reasons" why modules are included...

Here's the formatted stats.json file for debugging: stats.zip

@d4rkr00t
Copy link
Owner

Oh, nice, thank you. I'll have a look at that

@d4rkr00t d4rkr00t reopened this Jun 18, 2019
@SuperOleg39
Copy link

@d4rkr00t hi, need any help? Have this problem too.

@d4rkr00t
Copy link
Owner

Hi @SuperOleg39 can you please attach stats.json, i tried the steps from previous messages but still can't reproduce it...

Steps:

npm i -g @angular/cli@7.3.8
ng new my-app
cd my-app
ng build --stats-json --prod --aot --verbose
npx whybundled dist/my-app/stats.json

@SuperOleg39
Copy link

@d4rkr00t i'm very sorry, forgot to write, just have wrong stats.json ((

@d4rkr00t
Copy link
Owner

No worries :) I’ll keep this one open anyway as people keep coming back with it.

@vanslly
Copy link

vanslly commented Feb 24, 2020

@SuperOleg39 @d4rkr00t I'm still getting the same issue.

Steps:

npm i -g @angular/cli@9.0.3
ng new my-app
cd my-app
ng build --stats-json --prod --aot --verbose
npx whybundled dist/my-app/stats-es2015.json

PS D:\dev\my-app> npx whybundled .\dist\my-app\stats-es2015.json
npx: installed 164 in 9.931s
ERROR Stats file ".\dist\my-app\stats-es2015.json" doesn't contain "reasons" why modules are included...

Looking inside the stats-es2015.json file I can see reasons arrays.

image

I support very many Angular apps and want to use whybundled with them.

@d4rkr00t
Copy link
Owner

Published a new version, should fix this one :)

@vanslly
Copy link

vanslly commented Feb 24, 2020

Works! Thanks @d4rkr00t

@d4rkr00t
Copy link
Owner

It was just me being stupid and forgetting to publish already fixed version :( Thank you for being persistent with this one 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants