This module, `subapp-pbundle`, version 1.1.1, serves as an integration layer for Electrode subapps utilizing the Preact UI framework and `redux-bundler` for state management. It essentially re-exports core functionalities from `subapp-web` and adapts them for Preact, including re-exporting Preact's `h`, `Component`, and `render` APIs for convenience. A key differentiator is its `reduxBundlerLoadSubApp` API, specifically designed for loading `redux-bundler`-based subapps within the Electrode ecosystem. The package is primarily distributed as ES modules, advocating for modern bundling practices like tree-shaking. While it provides server-side rendering (SSR) context support via `AppContext`, further support for advanced features like React Router and Preact Suspense remains "TBD," suggesting a slower release cadence or a maintenance-focused development cycle since its initial release around 2016 by WalmartLabs.
npm install subapp-pbundleVerified import paths — ran on the pinned version, not inferred.
Demonstrates defining an Electrode subapp with Preact, using `reduxBundlerLoadSubApp` and accessing SSR context via `AppContext`.
Ensure your project uses ES module syntax (`import`/`export`) and is configured for ESM. Modern bundlers like Webpack 4+ or Rollup handle this automatically, but legacy environments might require specific configuration.
Install `preact` and `preact-render-to-string` using your package manager: `npm install preact preact-render-to-string` or `yarn add preact preact-render-to-string`.
Integrate a polyfill service like `polyfill.io` or include necessary polyfills (e.g., using `core-js` with Babel) in your application's build process to ensure broad browser compatibility.
Rename your file to `.mjs`, add `"type": "module"` to your `package.json`, or configure your build system (e.g., Webpack) to correctly handle ESM modules.
Run `npm install preact preact-render-to-string` or `yarn add preact preact-render-to-string` in your project's root directory.
Include a polyfill for ES6+ features in your application. Common solutions include `core-js` or a service like `polyfill.io`.