Gathering detailed insights and metrics for subapp-pbundle
Gathering detailed insights and metrics for subapp-pbundle
Gathering detailed insights and metrics for subapp-pbundle
Gathering detailed insights and metrics for subapp-pbundle
npm install subapp-pbundle
Typescript
Module System
Node Version
NPM Version
Total Downloads
9,267
Last Day
1
Last Week
52
Last Month
91
Last Year
970
Minified
Minified + Gzipped
Latest Version
1.1.1
Package Id
subapp-pbundle@1.1.1
Unpacked Size
55.46 kB
Size
12.40 kB
File Count
30
NPM Version
8.15.0
Node Version
16.17.1
Published on
May 05, 2023
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
5,100%
52
Compared to previous week
Last Month
-37.2%
91
Compared to previous month
Last Year
0.9%
970
Compared to previous year
2
This module mainly serve to setup subapp-web with Preact framework, and the support for redux-bundler for Electrode subapps.
It basically re-exports the module subapp-web and sets it up with Preact specific APIs.
h
, Component
, and render
APIs.reduxBundlerLoadSubApp
API for loading subapps that use redux-bundler.This package only export its code for node.js with main
field and ES modules with module
field.
This is neccessary for webpack to do treeshaking when bundling code.
This module also depend on the app loading polyfills for ES6 libraries and APIs such as Promise
or array methods.
The recommendation is to use polyfill.io.
This package transpile ES6 syntax to ES5 syntax and depend on [@babel/runtime] to provide helpers. It pulls version 7.
To use, a subapp's code should be doing:
1/** @jsx h */ 2import { h, reduxBundlerLoadSubApp } from "subapp-pbundle"; 3 4import Component from "./component"; 5 6export default reduxBundlerLoadSubApp({ name: "MyComponent", Component });
preact
and preact-render-to-string
are specified as peerDependencies, so you must install them as part of your package.json
dependencies.
This module also exports a default Preact context that SSR uses to pass in server request
object to your React component.
ie:
1import { AppContext } from "subapp-pbundle"; 2 3const Component = () => { 4 return ( 5 <AppContext.Consumer> 6 {({ isSsr, ssr, subApp }) => { 7 return ( 8 <div> 9 IS_SSR: {`${Boolean(isSsr)}`} HAS_REQUEST: {ssr && ssr.request ? "yes" : "no"} 10 </div> 11 ); 12 }} 13 </AppContext.Consumer> 14 ); 15};
TBD
Preact Suspense support is still experimental. TBD.
Copyright (c) 2016-present, WalmartLabs
Licensed under the Apache License, Version 2.0.
No vulnerabilities found.
No security vulnerabilities found.