-
-
Notifications
You must be signed in to change notification settings - Fork 562
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]: prebundle rspack config file by rspack itself for better config extensions support #2237
Comments
I'm particularly interested in support for .cjs config because all my projects have "type": "module" in package.json. But when changing the sample provided "rspack.config.js" (with no requires or imports) to "rspack.config.cjs", then I get the following:
|
@wernerbihl .cjs is supported |
@fi3ework prebundle may meet lots of issue like web-infra-dev/modern.js#3338 when used in monorepo, if we bundle code in other package it will cause the bundled config can't find the its dependencies, so we think transformer is less prone |
Prebundling could externalize bare imports, which would skip libraries in a monorepo, but still will meet |
if config a in packageA use source b in packageB which has dependency c, when we do prebundle it will cause b is bundled in bundled_a file which is in packageB, then we do resolve dependency in bundle_a it will resolve failed because lies in packageB's node_modules other than packageA's node_modules
when bundled config_a it will becomes
then require('c') will failed because packageA doesn't have c in node_modules |
Yes, it will. I was trying to say that making bare import externalized will keep resolving |
then we will stick to transformer solution for now and may use rspack itself to transform config one day. |
closed as not planned |
What problem does this feature solve?
Support multiple config file extensions, such as
mjs
ts
cjs
mts
cts
, especiallyts
for better intellisense and type check.What does the proposed API of configuration look like?
Utilize rspack itself to pre-bundle the config file. The bundling should have the following features:
require.extensions
to load CJS and use temp file (before--loader
landed) for ESM.The text was updated successfully, but these errors were encountered: