Giter VIP home page Giter VIP logo

bundle-stats-action's Introduction

bundle-stats-action's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar vio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bundle-stats-action's Issues

Cannot create a string longer than 0x1fffffe8 characters

Running it in GitHub CI results in the following error:

Run vio/bundle-stats-action@v1
  with:
    id: bundle-stats-nodejs
    webpack-stats-path: .next/server/stats/webpack-nodejs-stats.json
    repo-token: ***
  env:
    MSYS: winsymlinks:nativestrict
Error: Cannot create a string longer than 0x1fffffe8 characters

I tried googling it and it related to out of memory error and JSON serialization/deserialization.

In my other project, using JSON.serialize() is an OOM,
so I was using

const { stringifyStream } = require("@discoveryjs/json-ext");

stringifyStream(stats.toJson(this.statsOptions))
        .on("end", () => callback())
        .on("error", e => callback(e))
        .pipe(fs.createWriteStream(file));

Invalid webpack stats structure, please make sure webpack stats configuration is correct.

Get an error when using the github action task. Looking at the webpack.stats.json file, it looks valid. I'm also building before running the task.

Is there something missing from the config? Or is there a bug in the package?

Error:

Run vio/[email protected]
  with:
    webpack-stats-path: public/webpack.stats.json
Warning: Invalid webpack stats structure, please make sure webpack stats configuration is correct.

Expected a value of type `interface<{name,size}> | interface<{type,filteredChildren,size}>[] & notEmptyArray` for `assets`

Github action

...
    - run: npm ci
    - run: npm run build 
    
    - run: cat public/webpack.stats.json  #<--- shows expected output
    
    - name: BundleStats
      with:
        webpack-stats-path: public/webpack.stats.json

Local config

"gatsby-plugin-bundle-stats": "^3.1.3",

gatsby,config:

module.exports = {
     ....
     plugins: [
     ....
          `gatsby-plugin-bundle-stats`,
     ]
}

Resulting webpack.stats.json after the build:

Click to see webpack.stats.json
{
  "namedChunkGroups": {
  	"polyfill": {
  		"name": "polyfill",
  		"assets": [
  			{
  				"name": "webpack-runtime-2a855710d5ae874450ac.js",
  				"size": 5859
  			},
  			{
  				"name": "polyfill-3a0d770c34c43c9f7104.js",
  				"size": 85327
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 91186,
  		"filteredAuxiliaryAssets": 2,
  		"auxiliaryAssetsSize": 229213
  	},
  	"app": {
  		"name": "app",
  		"assets": [
  			{
  				"name": "webpack-runtime-2a855710d5ae874450ac.js",
  				"size": 5859
  			},
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "framework-05788807507524b21166.js",
  				"size": 130644
  			},
  			{
  				"name": "app-6b6975afa36ed733fa92.js",
  				"size": 70699
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 227133,
  		"filteredAuxiliaryAssets": 55,
  		"auxiliaryAssetsSize": 1779769
  	},
  	"component---src-pages-404-js": {
  		"name": "component---src-pages-404-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-pages-404-js-8c5bda6c7e063a6b94cd.js",
  				"size": 562
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 38439,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1189901
  	},
  	"component---src-pages-ancient-beech-tree-js": {
  		"name": "component---src-pages-ancient-beech-tree-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-pages-ancient-beech-tree-js-24ac9683916683c69cdc.js",
  				"size": 6902
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 44779,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1197319
  	},
  	"component---src-pages-contact-js": {
  		"name": "component---src-pages-contact-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-pages-contact-js-1c3ac0e496dd619ce646.js",
  				"size": 2166
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 40043,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1192243
  	},
  	"component---src-pages-firewood-js": {
  		"name": "component---src-pages-firewood-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-pages-firewood-js-6deca132b5d03f18d187.js",
  				"size": 2019
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 39896,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1190812
  	},
  	"component---src-pages-history-js": {
  		"name": "component---src-pages-history-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-pages-history-js-af409ed5fb12c8a596cb.js",
  				"size": 2067
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 39944,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1191687
  	},
  	"component---src-pages-index-js": {
  		"name": "component---src-pages-index-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-pages-index-js-4251dce3460488a61f7f.js",
  				"size": 2013
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 39890,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1191665
  	},
  	"component---src-pages-news-js": {
  		"name": "component---src-pages-news-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-pages-news-js-8e516bb0e0a763c6b313.js",
  				"size": 2081
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 39958,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1194796
  	},
  	"component---src-pages-trees-english-oak-js": {
  		"name": "component---src-pages-trees-english-oak-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-pages-trees-english-oak-js-32aef83df0cf7b341ab3.js",
  				"size": 4313
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 42190,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1194235
  	},
  	"component---src-pages-trees-js": {
  		"name": "component---src-pages-trees-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-pages-trees-js-ed364ecaf3137b029b39.js",
  				"size": 1926
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 39803,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1192374
  	},
  	"component---src-pages-work-days-js": {
  		"name": "component---src-pages-work-days-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-pages-work-days-js-35beb0fad8d5a86892f2.js",
  				"size": 2203
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 40080,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1193896
  	},
  	"component---src-templates-blog-post-js": {
  		"name": "component---src-templates-blog-post-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-templates-blog-post-js-4bd85a0aad2874e6e5ae.js",
  				"size": 2173
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 40050,
  		"filteredAuxiliaryAssets": 54,
  		"auxiliaryAssetsSize": 1195575
  	},
  	"component---src-templates-work-day-information-js": {
  		"name": "component---src-templates-work-day-information-js",
  		"assets": [
  			{
  				"name": "styles.6d64adc0dc1481d6e4f4.css",
  				"size": 19931
  			},
  			{
  				"name": "framework-05788807507524b21166.js",
  				"size": 130644
  			},
  			{
  				"name": "commons-392752f5e0f0824f9018.js",
  				"size": 17946
  			},
  			{
  				"name": "component---src-templates-work-day-information-js-4f3e58a180a089092948.js",
  				"size": 34982
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 203503,
  		"filteredAuxiliaryAssets": 55,
  		"auxiliaryAssetsSize": 1638027
  	},
  	"polyfills-dom": {
  		"name": "polyfills-dom",
  		"assets": [
  			{
  				"name": "polyfills-dom-b1145c2073fd51c6a9cb.js",
  				"size": 18668
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 18668,
  		"filteredAuxiliaryAssets": 1,
  		"auxiliaryAssetsSize": 53890
  	},
  	"polyfills-core-js": {
  		"name": "polyfills-core-js",
  		"assets": [
  			{
  				"name": "polyfills-core-js-b700803b49783ff8dbe3.js",
  				"size": 105674
  			}
  		],
  		"filteredAssets": 0,
  		"assetsSize": 105674,
  		"filteredAuxiliaryAssets": 1,
  		"auxiliaryAssetsSize": 361157
  	}
  },
  "assetsByChunkName": {
  	"polyfill": [
  		"webpack-runtime-2a855710d5ae874450ac.js",
  		"polyfill-3a0d770c34c43c9f7104.js"
  	],
  	"app": [
  		"webpack-runtime-2a855710d5ae874450ac.js",
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"framework-05788807507524b21166.js",
  		"app-6b6975afa36ed733fa92.js"
  	],
  	"component---src-pages-404-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-pages-404-js-8c5bda6c7e063a6b94cd.js"
  	],
  	"component---src-pages-ancient-beech-tree-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-pages-ancient-beech-tree-js-24ac9683916683c69cdc.js"
  	],
  	"component---src-pages-contact-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-pages-contact-js-1c3ac0e496dd619ce646.js"
  	],
  	"component---src-pages-firewood-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-pages-firewood-js-6deca132b5d03f18d187.js"
  	],
  	"component---src-pages-history-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-pages-history-js-af409ed5fb12c8a596cb.js"
  	],
  	"component---src-pages-index-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-pages-index-js-4251dce3460488a61f7f.js"
  	],
  	"component---src-pages-news-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-pages-news-js-8e516bb0e0a763c6b313.js"
  	],
  	"component---src-pages-trees-english-oak-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-pages-trees-english-oak-js-32aef83df0cf7b341ab3.js"
  	],
  	"component---src-pages-trees-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-pages-trees-js-ed364ecaf3137b029b39.js"
  	],
  	"component---src-pages-work-days-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-pages-work-days-js-35beb0fad8d5a86892f2.js"
  	],
  	"component---src-templates-blog-post-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-templates-blog-post-js-4bd85a0aad2874e6e5ae.js"
  	],
  	"component---src-templates-work-day-information-js": [
  		"styles.6d64adc0dc1481d6e4f4.css",
  		"framework-05788807507524b21166.js",
  		"commons-392752f5e0f0824f9018.js",
  		"component---src-templates-work-day-information-js-4f3e58a180a089092948.js"
  	],
  	"polyfills-dom": [
  		"polyfills-dom-b1145c2073fd51c6a9cb.js"
  	],
  	"polyfills-core-js": [
  		"polyfills-core-js-b700803b49783ff8dbe3.js"
  	]
  },
  "childAssetsByChunkName": {}
}

Invalid webpack stats structure, please make sure webpack stats configuration is correct.

here's the warning:

Run vio/bundle-stats-action@v1
  with:
    webpack-stats-path: bundle-stats.json
    repo-token: ***
Warning: Invalid webpack stats structure, please make sure webpack stats configuration is correct.

Expected a nonempty array but received an empty one
Path: assets
Failed structure(assets): []

I ran a cat on the file because I thought I was going crazy:

    - name: Build
      run: yarn build

    - name: Run bundle-stats
      uses: vio/bundle-stats-action@v1
      with:
        webpack-stats-path: 'bundle-stats.json'
        repo-token: ${{ secrets.GITHUB_TOKEN }}

    - name: Check something
      run: cat bundle-stats.json

Partial output:

2022-12-12T23:06:01.0902096Z         }
2022-12-12T23:06:01.0902261Z       ],
2022-12-12T23:06:01.0902537Z       "biggerIsBetter": false,
2022-12-12T23:06:01.0902751Z       "label": "Other",
2022-12-12T23:06:01.0902951Z       "changed": false
2022-12-12T23:06:01.0903132Z     }
2022-12-12T23:06:01.0903290Z   ],
2022-12-12T23:06:01.0903454Z   "assets": [
2022-12-12T23:06:01.0903628Z     {
2022-12-12T23:06:01.0903860Z       "key": "static/js/vendors~main.js",
2022-12-12T23:06:01.0904081Z       "runs": [
2022-12-12T23:06:01.0904256Z         {
2022-12-12T23:06:01.0904520Z           "name": "static/js/vendors~main.e563ef6c.js",
2022-12-12T23:06:01.0904776Z           "value": 3252233,
2022-12-12T23:06:01.0904993Z           "isEntry": false,
2022-12-12T23:06:01.0905198Z           "isInitial": true,
2022-12-12T23:06:01.0905462Z           "isChunk": true,
2022-12-12T23:06:01.0905718Z           "chunkId": "vendors~main",
2022-12-12T23:06:01.0905979Z           "displayValue": "3.1MiB"
2022-12-12T23:06:01.0906189Z         }
2022-12-12T23:06:01.0906362Z       ],
2022-12-12T23:06:01.0906580Z       "biggerIsBetter": false,
2022-12-12T23:06:01.0906859Z       "label": "static/js/vendors~main.js",
2022-12-12T23:06:01.0907082Z       "changed": false
2022-12-12T23:06:01.0907275Z     },

Any idea?

Multiple bundle path

How to use this if I have two bundle stats.json, one in .webpack/main/stats.json, another in .webpack/main/stats.json

Hey

Lorem ipsum

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.