[Feature]: Remove _webpack_require__.*
+ __webpack_exports__.*
definitions for CJS format in bundleless mode
#594
Labels
_webpack_require__.*
+ __webpack_exports__.*
definitions for CJS format in bundleless mode
#594
What problem does this feature solve?
I am in a similar situation to #219. I think it's not the same, so I'm posting a new issue.
From what I know,
rsbuild
and thereforerslib
are reimplementing the webpack algo. And that's cool. What I didn't expect is to use thebundle: false
, a.k.a. "bundleless" mode and get a ton of repeated__webpack_require__.*
definitions in each file forcjs
format.For example if I get an input file called
math.ts
with:The bundleless mode of
rslib
produces ESM output of:Which is fantastic, but the
cjs
(common js) version of of the same is:And that is for every file.
What does the proposed API look like?
No changes of API, changes of output to be more similar to other tools like
tsc
,rollup
, etc.If this is a fundamental thing for
rsbuild
andrslib
then at least those__webpack_*
definitions can be reused and not redefined in every file?When targeting
cjs
format,rollup
produces:When targeting
cjs
format & configured specifically for node 22 (via tsconfig base),tsc
produces:The text was updated successfully, but these errors were encountered: