SyntaxError: Unexpected token S in JSON at position 1
monolithed opened this issue · comments
➜ npm run stat
> tabgear@0.0.1 stat /Users/a.abashkin/workspace/github/tab-gear
> NODE_ENV=production webpack --display-reasons --optimize-minimize --progress --profile --display-error-details --config tasks/client.js --json | webpack-bundle-size-analyzer
clean-webpack-plugin: /Users/a.abashkin/workspace/github/tab-gear/tasks/cache has been removed.
5362ms build modules
7ms seal
29ms optimize
16ms hashing
30ms create chunk assets
4210ms additional chunk assets
4020ms optimize chunk assets
219ms optimize assets
1934ms emit
undefined:2
Starting to optimize CSS...
^
SyntaxError: Unexpected token S in JSON at position 1
at Object.parse (native)
at printStats (/Users/a.abashkin/workspace/github/tab-gear/node_modules/webpack-bundle-size-analyzer/build/src/cli.js:6:28)
at Socket.<anonymous> (/Users/a.abashkin/workspace/github/tab-gear/node_modules/webpack-bundle-size-analyzer/build/src/cli.js:27:50)
at emitNone (events.js:91:20)
at Socket.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
The JSON file can be downloaded here
Starting to optimize CSS...
^
SyntaxError: Unexpected token S in JSON at position 1
As I hope that message makes clear, the problem is that the input to webpack-bundle-size-analyzer
is not valid JSON. I'm afraid you need to fix that in your toolchain.
Seems that webpack v2 is outputting warnings/errors into json. When I ran it on webpack v1 it's fine.
Seems that webpack v2 is outputting warnings/errors into json. When I ran it on webpack v1 it's fine.
Does that output get written to stdout or stderr though? If you use the --json
option and get non-JSON output written to stdout that would clearly seem like a bug in Webpack or the plugins you are using.
I don't suppose you have a test case that reproduces the problem?