FormidableLabs / webpack-stats-plugin

Webpack stats plugin for build information, file manifests, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: must start with number, buffer, array or string

gpbl opened this issue Β· comments

πŸ‘‹ I've upgraded to 0.1.1 and now I get the following error using this config. I'm on node 4.

$ webpack --stats --config ./webpack/prod.config.js

buffer.js:167
  throw new TypeError('must start with number, buffer, array or string');
  ^

Am I missing something?

I've installed Node v4.1.2 and I'm trying different variations in https://github.com/FormidableLabs/webpack-stats-plugin/blob/master/demo/webpack.config.js#L16-L42 and I can't reproduce. Can you do a pull request / paste a code diff here with an update to https://github.com/FormidableLabs/webpack-stats-plugin/blob/master/demo/webpack.config.js#L16-L42 that errors with your error when running npm run build-demo?

Thanks!

Finally reproduced it. The issue is that we no longer JSON.stringify the result of a transform to allow users to do atypical things like generate Markdown output, etc.

So the following:

      transform: function (data) {
        return JSON.stringify({
          main: data.assetsByChunkName.main[0],
          css: data.assetsByChunkName.main[1]
        }, null, 2);
      }

Should fix your issue. Can you confirm and close?

In parallel, I work on the documentation to enhance / correct it surrounding the issue.

@gpbl -- Closing this as I think we've got your issue solved now. Feel free to re-open if that's not the case.

Thanks @ryan-roemer, it worked! Sorry for the late answer.

how to get this fix?

@aniket29081992 -- Please follow the example in my comment: #8 (comment)

If that doesn't work, please paste a GitHub link or a code snippet with context around your instantiation of new StatsWriterPlugin({ /*STUFF*/ })

Unable to understand this error :

err TypeError: must start with number, buffer, array or string
at fromObject (buffer.js:244:9)
at Function.Buffer.from (buffer.js:118:10)
at new Buffer (buffer.js:97:17)
at decodeCredentials (C:\Working\develop\src\Netchex\node_modules\jspm-github\github.js:55:14)
at Object.GithubLocation (C:\Working\develop\src\Netchex\node_modules\jspm-

github\github.js:112:19)
at Object.exports.load (C:\Working\develop\src\Netchex\node_modules\jspm\lib\registry.js:73:56)
at new RegistryPath (C:\Working\develop\src\Netchex\node_modules\jspm\lib\config\loader.js:264:33)
at Config.read (C:\Working\develop\src\Netchex\node_modules\jspm\lib\config\loader.js:127:26)
at C:\Working\develop\src\Netchex\node_modules\jspm\lib\config.js:100:26
at process._tickCallback (internal/process/next_tick.js:103:7)
at Function.Module.runMain (module.js:449:11)
at startup (node.js:148:18)
at node.js:405:3

@gvahinde - I don't see this loader in that stack trace and it looks like you're using jspm, not webpack?

If you are having an issue with this plugin, please open a new issue and include your full webpack configuration, the command you're running on the terminal and ideally full reproduction steps (if this is an open source project) so that we can better assist you.