Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Write rspack config in typescript #2188

Closed
marco2216 opened this issue Mar 12, 2023 · 6 comments
Closed

[Feature Request]: Write rspack config in typescript #2188

marco2216 opened this issue Mar 12, 2023 · 6 comments
Assignees
Labels
feat New feature or request good first issue Good for newcomers

Comments

@marco2216
Copy link

What problem does this feature solve?

Webpack config can be written in a ts file (webpack.config.ts). It would be very helpful to be able to do this for rspack as well, since we get type and ESM syntax support, and it makes it much easier to migrate existing configs to rspack. (existing webpack config may also have dependencies on other TS files, so it's not good to have to convert those to JS as well.)

What does the proposed API of configuration look like?

rspack.config.ts - follow webpack.

@marco2216 marco2216 added the feat New feature or request label Mar 12, 2023
@hardfist
Copy link
Contributor

you can use ts-node/register to handle ts config support right now, we will support ts config out of box in the future

  • rspack.config.js
require('ts-node/register');
your config here

@hardfist hardfist added the good first issue Good for newcomers label Mar 12, 2023
@HerringtonDarkholme
Copy link
Collaborator

Hi @hardfist , can I take this issue?

@HerringtonDarkholme
Copy link
Collaborator

HerringtonDarkholme commented Mar 13, 2023

Hi rspack team, I found webpack uses rechoir and interpret to load JS variants. Is it the desirable way to do it? Or do you prefer using minimal dependencies?

https://github.com/webpack/webpack-cli/blob/master/packages/webpack-cli/src/webpack-cli.ts#L1723

@hardfist
Copy link
Contributor

we prefer minimal

HerringtonDarkholme added a commit to HerringtonDarkholme/rspack that referenced this issue Mar 13, 2023
HerringtonDarkholme added a commit to HerringtonDarkholme/rspack that referenced this issue Mar 13, 2023
HerringtonDarkholme added a commit to HerringtonDarkholme/rspack that referenced this issue Mar 13, 2023
@leimonio
Copy link
Contributor

leimonio commented Aug 1, 2024

@hardfist What is the performance of using .js vs .ts rspack configuration files?

@leimonio
Copy link
Contributor

leimonio commented Aug 1, 2024

Also might be bit early, but any idea how the NodeJS experimental Typescript Support will change the current approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants