我需要一个包,既可以作为devDependency也可以作为依赖项

I ran into the issue that I need the same package as a dependency as well as devDependency.

The packages in question are @babel/core and @babel/preset-env.

为什么?

因为我的软件包提供了将来移植项目其他部分的接口:

  • Project source is transpiled with babel (this is the dev dependency part).
  • Transpiled source code is published on NPM.
  • In a second step the transpiled project source from npm is ran through webpack (webpack uses babel-loader and therefore needs @babel/core). This step is done by the end user via webpack.

I want to include every dev-asset (except webpack) in the package so that the end user doesn't need to install babel-loader, @babel/core etc..

我考虑过将它们添加为依赖项,但这似乎很不干净。

Maybe this is an X/Y problem?