webpack-contrib / webpack-bundle-analyzer

Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap
MIT License
12.53k stars 479 forks source link

"Unexpected token" when analyzing via packtracker #594

Closed rejas closed 1 year ago

rejas commented 1 year ago

Issue description

I noticed that our packtracker.io webpack-plugin started reporting bogus values after our latest "npm update" run.

Our logs show this error from the analyzer:

Unexpected token (1:245361)

This points to the updated markedjs package, right into the middle of this codeline:

https://github.com/markedjs/marked/blob/4c1a164f70c3fecf83286a2723e8c067eb782817/src/Hooks.js#L8

Downgrading only that package from v4.3.0 to v4.2.12 fixes the error and the packtracker stats are ok again.

Not sure why the parser doesnt like this line / codechange though, running the analyzer with the CLI directly from our code doesnt bring this error.

So maybe it is a packtracker plugin issue, but I am not sure, maybe you can weigh in on this.

Technical info

  System:
    OS: macOS 13.3
    CPU: (8) arm64 Apple M1 Pro
    Memory: 201.80 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm
  npmPackages:
    clean-webpack-plugin: ^4.0.0 => 4.0.0 
    css-minimizer-webpack-plugin: ^3.4.1 => 3.4.1 
    image-minimizer-webpack-plugin: ^3.8.1 => 3.8.2 
    terser-webpack-plugin: ^5.3.6 => 5.3.7 
    webpack: ^5.76.0 => 5.76.3 
    webpack-bundle-analyzer: ^4.6.1 => 4.8.0 
    webpack-dev-middleware: ^5.3.3 => 5.3.3 
    webpack-hot-middleware: ^2.25.3 => 2.25.3 
    webpack-manifest-plugin: ^5.0.0 => 5.0.0 
    webpack-merge: ^5.8.0 => 5.8.0 
    webpack-node-externals: ^3.0.0 => 3.0.0 

Debug info

How do you use this module? As CLI utility or as plugin?

As a dependency in the packtracker.io webpack plugin. Not sure how to get the stats.json out of that...