# @lynx-js/lynx-bundle-rslib-config

## 0.7.1

### Patch Changes

- Updated dependencies [[`9c2be3e`](https://github.com/lynx-family/lynx-stack/commit/9c2be3e239daf55f55a1991a9490705aa3587f46), [`cf98e14`](https://github.com/lynx-family/lynx-stack/commit/cf98e1461a8d571350d0c125ac095cc8531ac8f8), [`3bf135c`](https://github.com/lynx-family/lynx-stack/commit/3bf135c0bc8e30a9743b4a0d0dba18337d68b881), [`ae25e93`](https://github.com/lynx-family/lynx-stack/commit/ae25e93c63cb793cf53d99ce7345de0320b68046), [`9c2be3e`](https://github.com/lynx-family/lynx-stack/commit/9c2be3e239daf55f55a1991a9490705aa3587f46)]:
  - @lynx-js/css-serializer@0.1.9
  - @lynx-js/web-core@0.25.0

## 0.7.0

### Minor Changes

- Require `@rslib/core ^1.0.0-beta.1` in `peerDependencies`, matching the `output.autoExternal` usage introduced by the Rslib v1 upgrade. ([#3437](https://github.com/lynx-family/lynx-stack/pull/3437))

### Patch Changes

- Updated dependencies [[`948eece`](https://github.com/lynx-family/lynx-stack/commit/948eece02aa9f7051f879a21f6c51d96a99fe1aa), [`e35739a`](https://github.com/lynx-family/lynx-stack/commit/e35739aa0ca3b46b74ad0bd681c3fbfcf183c7ec), [`365cc58`](https://github.com/lynx-family/lynx-stack/commit/365cc580d076db4878ff95da7f15d2c9044fbe87)]:
  - @lynx-js/css-serializer@0.1.8
  - @lynx-js/web-core@0.24.1

## 0.6.3

### Patch Changes

- Updated dependencies [[`fd1e300`](https://github.com/lynx-family/lynx-stack/commit/fd1e300fb6f94dc4336a4fd1999c244a2e64f3a3), [`5fbabb8`](https://github.com/lynx-family/lynx-stack/commit/5fbabb8fb06fd9a46d20348ea7ec8b1a9e6e1c85), [`cc5c714`](https://github.com/lynx-family/lynx-stack/commit/cc5c71453f12a3feb3f78b6067a049ef52b4fcd5)]:
  - @lynx-js/web-core@0.24.0

## 0.6.2

### Patch Changes

- Align `@lynx-js/tasm` with `@lynx-js/template-webpack-plugin` on `0.0.49`. ([#3287](https://github.com/lynx-family/lynx-stack/pull/3287))

- Require `@rslib/core` 0.22.0 or later and consume Rspack types through Rslib so ([#3271](https://github.com/lynx-family/lynx-stack/pull/3271))
  the Rspack v2 toolchain is used without a separate `@rspack/core` dependency.
- Updated dependencies [[`080da86`](https://github.com/lynx-family/lynx-stack/commit/080da8606b9792b2eb5aa59cbcbd7807ad598ce2), [`aeb9438`](https://github.com/lynx-family/lynx-stack/commit/aeb9438f817473f0f04baf719ef04d709f3894d6), [`e42a1a6`](https://github.com/lynx-family/lynx-stack/commit/e42a1a6e089a49f2647694ccae3301a291ff1129)]:
  - @lynx-js/web-core@0.23.1

## 0.6.1

### Patch Changes

- Update `@lynx-js/tasm` from `0.0.39` to `0.0.48` ([#3085](https://github.com/lynx-family/lynx-stack/pull/3085))

- Updated dependencies [[`16248b5`](https://github.com/lynx-family/lynx-stack/commit/16248b55b37375402d63d2b53e40e832ab6544c6), [`7c08120`](https://github.com/lynx-family/lynx-stack/commit/7c08120315f1802d84d2f01a0075293c7e0059cb), [`924106b`](https://github.com/lynx-family/lynx-stack/commit/924106b049a0764900f2557abc1c31aec77ad037), [`0d3623b`](https://github.com/lynx-family/lynx-stack/commit/0d3623bae7741223083b2723af87a0d32226d01e), [`f5da344`](https://github.com/lynx-family/lynx-stack/commit/f5da34447cc8884cf7ca518f6fc1c1544be61352), [`6369383`](https://github.com/lynx-family/lynx-stack/commit/63693831513364aae6c2d8d13b3f6a50303a8d42), [`e75b561`](https://github.com/lynx-family/lynx-stack/commit/e75b5619c567d9fd28897990281f6332bf6d88c4), [`40c9804`](https://github.com/lynx-family/lynx-stack/commit/40c9804713ee982b99da37981e2e34408c370c77)]:
  - @lynx-js/runtime-wrapper-webpack-plugin@0.2.3
  - @lynx-js/web-core@0.23.0
  - @lynx-js/css-serializer@0.1.7

## 0.6.0

### Minor Changes

- Keep JsBytecode debug info (per-function `pc2line` tables) out of external bundles, significantly reducing the size of bytecode-encoded main thread chunks. ([#2955](https://github.com/lynx-family/lynx-stack/pull/2955))

- Add an `enableJsBytecode` option to control compiling main thread chunks to JsBytecode. Defaults to `false` when `NODE_ENV` is `'development'`, `true` otherwise. ([#2954](https://github.com/lynx-family/lynx-stack/pull/2954))

- Support async externals in `defineExternalBundleRslibConfig`. An external can now use the object form `{ libraryName, async: true }` to emit a `promise` external, so importing modules await the library namespace mounted as a Promise by the host application and pick subpath segments after it resolves. ([#2928](https://github.com/lynx-family/lynx-stack/pull/2928))

  The output library type also switches from Rslib's default `commonjs-static` to `commonjs2`, so an async entry exports its namespace Promise as a whole instead of a static per-name copy that would read `undefined`. A sync entry exports the same namespace object as before.

- `output.externalsPresets` entries accept the `{ async: true }` object form, so a produced external bundle awaits its ReactLynx externals (the `promise` external) before reading a subpath — required on web. External bundle builds also flag their react loaders as `isExternalBundle` so ReactLynx snapshots use the `__Card__` entry name. ([#2934](https://github.com/lynx-family/lynx-stack/pull/2934))

### Patch Changes

- Support enabling preact devtools for external bundles via the `REACT_DEVTOOL` environment variable. ([#2980](https://github.com/lynx-family/lynx-stack/pull/2980))

  When `REACT_DEVTOOL` is set, `defineExternalBundleRslibConfig` now keeps function and class names during minification (`keep_fnames`/`keep_classnames` on both `compress` and `mangle`), which devtools needs to resolve component names (`type.name`) and to reconstruct the hook tree (it matches minified stack frames by function name). The default output is unchanged when `REACT_DEVTOOL` is unset. This mirrors `pluginMinify` in `@lynx-js/rspeedy` (#2880).

- Updated dependencies [[`60cb231`](https://github.com/lynx-family/lynx-stack/commit/60cb23172e40af8dd62a5f961a9f053c482030fc)]:
  - @lynx-js/web-core@0.22.2
  - @lynx-js/runtime-wrapper-webpack-plugin@0.2.2

## 0.5.1

### Patch Changes

- Updated dependencies [[`7a6577a`](https://github.com/lynx-family/lynx-stack/commit/7a6577a5b29db4020cbba22a911f712bafde7e66)]:
  - @lynx-js/runtime-wrapper-webpack-plugin@0.2.1
  - @lynx-js/web-core@0.22.1

## 0.5.0

### Minor Changes

- Add a `web` encode target to `defineExternalBundleRslibConfig` (`encodeOptions.target: 'web'`). ([#2846](https://github.com/lynx-family/lynx-stack/pull/2846))

  When set, the external bundle is emitted as a web binary bundle (`<name>.web.bundle`, encoded via `@lynx-js/web-core/encode`) that the Lynx web platform can decode and load with `lynx.fetchBundle` / `lynx.loadScript`. For the web target, each section is routed to the bundle slot whose chunk format it matches — the main-thread chunk into `lepusCode`, other JS chunks into `manifest`, and CSS into `StyleInfo` — emitting JS as raw source (the web runtime wraps it at load). The default `target: 'tasm'` (the native bundle via `@lynx-js/tasm`) is unchanged.

### Patch Changes

- Updated dependencies [[`46573b5`](https://github.com/lynx-family/lynx-stack/commit/46573b5f7fb59a8f85492cb1f6929887d77a5a42), [`88922df`](https://github.com/lynx-family/lynx-stack/commit/88922df8e09696eb4e24a027e3ed7269f9cc05f1)]:
  - @lynx-js/web-core@0.22.0

## 0.4.0

### Minor Changes

- **BREAKING CHANGE** ([#2803](https://github.com/lynx-family/lynx-stack/pull/2803))

  Drop webpack support — the plugins now target Rspack only. All public types come from `@rspack/core` instead of `webpack` (e.g. `Compiler`, `Compilation`, `LoaderContext`), and the `webpack` dependency is removed.

- Align Rspeedy, the QRCode plugin, and the Lynx bundle Rslib config Node.js engine metadata with Rsbuild v2 and Rslib requirements: Node.js 20.19+ or 22.12+. ([#2789](https://github.com/lynx-family/lynx-stack/pull/2789))

### Patch Changes

- Updated dependencies [[`e0aa6a3`](https://github.com/lynx-family/lynx-stack/commit/e0aa6a3f4fc8ba848a3a41789b3775a46fea24dc)]:
  - @lynx-js/runtime-wrapper-webpack-plugin@0.2.0

## 0.3.3

### Patch Changes

- Update the @lynx-js/tasm dependency to 0.0.39 and align React template attribute descriptors with it. ([#2643](https://github.com/lynx-family/lynx-stack/pull/2643))

## 0.3.2

### Patch Changes

- Support compile main-thread script to bytecode in external bundle ([#2459](https://github.com/lynx-family/lynx-stack/pull/2459))

- Updated dependencies [[`e179680`](https://github.com/lynx-family/lynx-stack/commit/e1796803444ba70efa86609b620c3a753b6694de)]:
  - @lynx-js/css-serializer@0.1.6

## 0.3.1

### Patch Changes

- Updated dependencies [[`156d64d`](https://github.com/lynx-family/lynx-stack/commit/156d64da67e83dfc92e63568cee602c21db873cf), [`59d11b2`](https://github.com/lynx-family/lynx-stack/commit/59d11b2549e5d2ca2ef18c5fe238c468e6db7d9a)]:
  - @lynx-js/css-serializer@0.1.5

## 0.3.0

### Minor Changes

- **BREAKING CHANGE**: ([#2370](https://github.com/lynx-family/lynx-stack/pull/2370))

  Simplify the API for external bundle builds by `externalsPresets` and `externalsPresetDefinitions`.

### Patch Changes

- Preserve the default external-bundle `output.minify.jsOptions` when users set `output.minify: true` in `defineExternalBundleRslibConfig`, so required minifier options are not lost. ([#2390](https://github.com/lynx-family/lynx-stack/pull/2390))

## 0.2.3

### Patch Changes

- Fix snapshot not found error when dev with external bundle ([#2316](https://github.com/lynx-family/lynx-stack/pull/2316))

## 0.2.2

### Patch Changes

- Support bundle and load css in external bundle ([#2143](https://github.com/lynx-family/lynx-stack/pull/2143))

## 0.2.1

### Patch Changes

- Add [`globalObject`](https://webpack.js.org/configuration/output/#outputglobalobject) config for external bundle loading, user can configure it to `globalThis` for BTS external bundle sharing. ([#2123](https://github.com/lynx-family/lynx-stack/pull/2123))

## 0.2.0

### Minor Changes

- Use `LAYERS` exposed by DSL plugins ([#2114](https://github.com/lynx-family/lynx-stack/pull/2114))

## 0.1.0

### Minor Changes

- Update external bundle minimum SDK version to 3.5. ([#2037](https://github.com/lynx-family/lynx-stack/pull/2037))

### Patch Changes

- Fix `globDynamicComponentEntry is not defined` error when minify is enabled in external bundle consumer. ([#2058](https://github.com/lynx-family/lynx-stack/pull/2058))

## 0.0.2

### Patch Changes

- Introduce `@lynx-js/externals-loading-webpack-plugin`. It will help you to load externals built by `@lynx-js/lynx-bundle-rslib-config`. ([#1924](https://github.com/lynx-family/lynx-stack/pull/1924))

  ```js
  // webpack.config.js
  import { ExternalsLoadingPlugin } from '@lynx-js/externals-loading-webpack-plugin'

  export default {
    plugins: [
      new ExternalsLoadingPlugin({
        mainThreadLayer: 'main-thread',
        backgroundLayer: 'background',
        externals: {
          lodash: {
            url: 'http://lodash.lynx.bundle',
            background: { sectionPath: 'background' },
            mainThread: { sectionPath: 'main-thread' },
          },
        },
      }),
    ],
  }
  ```

## 0.0.1

### Patch Changes

- Add `@lynx-js/lynx-bundle-rslib-config` for bundling Lynx bundle with [Rslib](https://rslib.rs/): ([#1943](https://github.com/lynx-family/lynx-stack/pull/1943))

  ```js
  // rslib.config.js
  import { defineExternalBundleRslibConfig } from '@lynx-js/lynx-bundle-rslib-config'

  export default defineExternalBundleRslibConfig({
    id: 'utils-lib',
    source: {
      entry: {
        utils: './src/utils.ts',
      },
    },
  })
  ```
