nonzzz/vite-bundle-analyzer

openAnalyzer: false is ignored

vxsx opened this issue · 4 comments

vxsx commented

Describe the issue

with the configuration

      analyzer({ analyzerMode: 'static', openAnalyzer: false }),

the server starts, instead of finishing the build

Expected behavior

It still runs the server, because preferOpenServer is true even if openAnalyzer is false

const preferOpenServer = opts.analyzerMode === 'server' || opts.analyzerMode === 'static'
const preferSilent = opts.analyzerMode === 'json' || (opts.analyzerMode === 'static' && !opts.openAnalyzer)

Steps to reproduce

Just run the build with this configuration.

Test case

No response

Additional comments

No response

vxsx commented

I understand starting the server and opening browser are slightly different things, but i expect "static" mode to not start the server.

I believe the fix would be just to add the condition

const preferOpenServer = opts.analyzerMode === 'server' || (opts.analyzerMode === 'static' && opts.openAnalyzer)

@vxsx You're right. my mistake.

Done! new version is released.

vxsx commented

Yup, works with the new version. Thanks a lot!