v0.6.0
Highlights ✨
This release brings exciting new features and improvements to Rslib:
-
New default library type for CJS: Rslib changes the default value of output.library.type for CJS from
commonjstocommonjs-static. Now, individual exports will be set as properties onmodule.exportsand the output can be statically analyzable, thus named exports are importable into ESM via Node.js. This is useful when source code is written in ESM and the output should be compatible with both CJS and ESM. (#819)Named exports are importable into ESM via Node.js
- Input:
export function doSomething() {}
- Output:
function doSomething() {} // … exports.doSomething = __webpack_exports__.doSomething;
- Consumption (CJS):
const { doSomething } = require('./output.cjs'); // doSomething => [Function: doSomething]
- Consumption (ESM):
import { doSomething } from './output.cjs'; // doSomething => [Function: doSomething]
-
Show code frame for type errors: Rslib now shows full context and code frame of tsc diagnostics in the terminal when generating declaration files. This makes it easier to understand and fix issues in the source code. (#847)
What's Changed
New Features 🎉
Bug Fixes 🐞
- fix(dts): add missing
optionalDependenciestype by @Timeless0911 in #872
Document 📖
- docs: enhance
output.assetPrefixby @Timeless0911 in #866 - docs(json): add documents for YAML and TOML file support by @oljc in #873
- docs: fix Discord URL by @Netail in #874
- docs: add default module definition systems by @Timeless0911 in #878
Other Changes
- chore(deps): bump Rslib/Rspress/Rsbuild by @Timeless0911 in #865
- chore(deps): update dependency simple-git-hooks to ^2.12.1 by @renovate in #871
- chore(deps): update all patch dependencies by @renovate in #870
- chore(deps): update Rsbuild to v1.3.0-beta.2 by @chenjiahan in #875
- test: add YAML and TOML tests by @Timeless0911 in #876
- refactor: use sync hook of
afterCompileby @fi3ework in #877 - chore(deps): update all patch dependencies by @renovate in #879
- Release v0.6.0 by @Timeless0911 in #880
New Contributors
Full Changelog: v0.5.5...v0.6.0
