Comments (6)
Yes, output.library.type = 'commonjs-static'
should already fixed in the main branch, the fix will be released in v0.7.0
and @JSerFeng will fix the mangleExports soon, should also be released in v0.7.0
from rspack.
Seems to be a bug of optimization.mangleExports
, cc @JSerFeng
should use info.used_name
here?
from rspack.
@LingyuCoder
Btw, I also tried to output files in cjs but failed.
I can not get something like module.exports = { t as hello };
but only an IIFE.
Could you give me an example for how to configure rspack to output files in cjs in library mode?
from rspack.
@LingyuCoder Btw, I also tried to output files in cjs but failed. I can not get something like
module.exports = { t as hello };
but only an IIFE. Could you give me an example for how to configure rspack to output files in cjs in library mode?
try to set output.library.type = "commonjs2"
like:
/** @type {import("@rspack/core").Configuration} */
module.exports = {
output: {
library: {
type: "commonjs2"
}
},
};
from rspack.
@LingyuCoder
Thanks! I got what I want by setting output.library.type
to commonjs2
or commonjs
.
But I found another diff which may be a bug.
When setting output.library.type
to commonjs-static
, there is a diff like this.
// v0.5.9
var r = n('294');
(exports.handler = r.handler), Object.defineProperty(exports, '__esModule', { value: !0 });
// v0.6.5
n('294'),
Object.defineProperty(exports, '__esModule', { value: !0 });
Just reporting.
from rspack.
@LingyuCoder Thanks! I got what I want by setting
output.library.type
tocommonjs2
orcommonjs
.But I found another diff which may be a bug. When setting
output.library.type
tocommonjs-static
, there is a diff like this.// v0.5.9 var r = n('294'); (exports.handler = r.handler), Object.defineProperty(exports, '__esModule', { value: !0 }); // v0.6.5 n('294'), Object.defineProperty(exports, '__esModule', { value: !0 });Just reporting.
cc @ahabhgk , relate to full aligning library bootstrap with webpack
from rspack.
Related Issues (20)
- [Tracking]: Rsnext support
- [Feature]: Detect recursive import HOT 1
- [Bug]: Random error with CopyRspackPlugin HOT 2
- [Bug]: Rspack does not allow to set target based on browserlist entries
- [Bug]: The production environment page crashes and reports TypeError when the version is upgraded to 1.0.0-alpha.5
- [Bug]: rspack.CopyRspackPlugin modifies file content HOT 2
- [Feature]: port css-extract latest features
- [Bug]:CopyRspackPlugin ζδ»Άζ₯ι HOT 7
- [Bug]: Panic occurred when recompile in serve/watch mode (rspack v 1.0.0-alpha.5) HOT 1
- [Bug]: Rspack is slower than Webpack when building a Vue project HOT 9
- [Bug]: Weird `@module-federation/runtime/rspack` log with Rspack v1.x.x
- [Bug]: Rspack errors seem to not support the correct location HOT 1
- [Bug]: `chunkGroup.isInitial` is not a function
- [Tracking]: better diagnostic report of tapable error
- HarmonyImportSideEffectDependency
- 1 HOT 1
- [Bug]: the decorator of method in hoc lead to runtime error after compilation HOT 1
- Upgrade Rust version to 1.80.0 nightly HOT 1
- [Bug]: svg inline not respect user configuration of browser compatibility
- [Bug]: resourceQuery not work in
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspack.