next-http-proxy-middleware icon indicating copy to clipboard operation
next-http-proxy-middleware copied to clipboard

Remove types from dependencies

Open stephane-segning opened this issue 2 years ago • 7 comments

Because this is part of the main dependencies, the overall package is very huge. This PR do fixes that

stephane-segning avatar Mar 18 '23 15:03 stephane-segning

Hi @stephane-segning

Thanks for your PR

Could you please check issue #17? (If you move the @types/http-proxydependency to the devDependencies field, the TS compiler will not properly interpret the NextHttpProxyMiddlewareOptions interface.)

Thanks 😀

stegano avatar Mar 19 '23 11:03 stegano

I've read your comment, @stegano. The thing is, that the error might come from the way it is compiled, not from the dependencies. I'm trying to provide an example of fix in the PR itself.

stephane-segning avatar Mar 20 '23 12:03 stephane-segning

To help me fix it, I was worknig on this other library https://github.com/TrySound/rollup-plugin-uglify/pull/91

stephane-segning avatar Mar 20 '23 12:03 stephane-segning

Hi @stephane-segning I'm sorry but I don't quite understand. Can you explain what part is the problem and what solved it?

If the user installs the next-http-proxy-middleware library, the @types/http-proxy dependency library must also be installed.

If you remove @types/http-proxy from the dependencies of this project, When user install next-http-proxy-middleware , @types/http-proxy must be installed separately. Do you think this is correct?

stegano avatar Mar 24 '23 06:03 stegano

The problem is the TS config. I've updated it quite a little bit. And also, you should include all *.d.ts files inside the final release of your app.

The lib @types/http-proxy should always be installed if a user is working with dev deps. Typically, in dev env.

If we put @types/http-proxy in dev-deps, the problem is solved. Now, if the client has any problems with it, they explain them to us and we solve them accordingly. But not by adding @types/* to the main deps.

stephane-segning avatar Mar 26 '23 00:03 stephane-segning

The problem is the TS config. I've updated it quite a little bit. And also, you should include all *.d.ts files inside the final release of your app.

The lib @types/http-proxy should always be installed if a user is working with dev deps. Typically, in dev env.

If we put @types/http-proxy in dev-deps, the problem is solved. Now, if the client has any problems with it, they explain them to us and we solve them accordingly. But not by adding @types/* to the main deps.

I'm sorry but I still don't quite understand,

  1. @types/http-proxy is a dependency module that must be installed to use this library. I don't understand why the user has to install this separately. If a user using this library already has another version of the http-proxy library installed, the user will be confused because they have to consider two versions of @types/http-proxy.

  2. Even if a user makes a product using this library, all typing (interface) files will be removed from the build result.

Please let me know if I'm misunderstanding something.

stegano avatar Mar 26 '23 02:03 stegano

The problem is the TS config. I've updated it quite a little bit. And also, you should include all *.d.ts files inside the final release of your app.

If you need to include all *.d.ts files(http-proxy, etc..) in the final release of your app, you should also include the original source code of the http-proxy library that this library depends on. This isn't common.

stegano avatar Mar 26 '23 03:03 stegano

Hi @stephane-segning, Thanks for your interest in this project. This issue is closed, please feel free to reopen this issue if necessary.

stegano avatar Jul 25 '24 02:07 stegano