ai / size-limit

Calculate the real cost to run your JS app or lib to keep good performance. Show error in pull request if the cost exceeds the limit.
MIT License
6.52k stars 1.82k forks source link

Incorrect config parsing #289

Closed JounQin closed 2 years ago

JounQin commented 2 years ago

https://github.com/ai/size-limit/blob/7461f32cddc403fe8ee6db4f8d43c9a76bfc9c52/packages/size-limit/run.js#L67-L72

It only looks up for package.json for plugins, and throws if no plugin found from package.json.

ai commented 2 years ago

What logic do you expect?

JounQin commented 2 years ago

https://github.com/ai/size-limit#config

@ai

ai commented 2 years ago

https://github.com/ai/size-limit#config

This config is for limits.

It is not for plugins.

Our API is that Size Limit takes plugins from package.json.

Why do you need plugins in the config?

JounQin commented 2 years ago

Size Limits supports three ways to define config.

I don't quite understand

This config is for limits.

It is not for plugins.

How should we define plugins in package.json?

Why do you need plugins in the config?

I'm trying to use modifyWebpackConfig.

JounQin commented 2 years ago

Besides, I want to use modifyWebpackConfig because I want to external all node modules from size calculation.

It seems no esbuild config to set.

ai commented 2 years ago

I don't quite understand

It means 3 different file names .size-limit.json or .size-limit.js or size-limit section in package.json

How should we define plugins in package.json?

Just add them to devDependencies.

For instance by:

npm install --save-dev @size-limit/webpack
ai commented 2 years ago

I am closing this issue since it is a question, not an issue.

Feel free to continue discussion with questions.

JounQin commented 2 years ago

I think it could be very confusing from current documentation.

ai commented 2 years ago

Please send PR if you know how to improve it

JounQin commented 2 years ago

@ai Please review #290