Skip to content

v0.6.0

Compare
Choose a tag to compare
@Timeless0911 Timeless0911 released this 27 Mar 06:57
· 135 commits to main since this release
73d3bd1

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 commonjs to commonjs-static. Now, individual exports will be set as properties on module.exports and 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)

    image

What's Changed

New Features 🎉

  • feat!: change to commonjs-static library type of commonjs format by @fi3ework in #819

Bug Fixes 🐞

Document 📖

Other Changes

New Contributors

Full Changelog: v0.5.5...v0.6.0