Skip to content

Commit f0ee4d6

Browse files
committed
fix: access possibly undefined variable appropriately
1 parent fa38a31 commit f0ee4d6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

canary/routes/CDN.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ export default function CDN() {
2727

2828

2929
(window as any).React = React; // expose React as global since the react-adobe embed cdn expects React to be loaded via cdn as well
30-
const ReactViewAdobe = (window as any).ReactAdobeEmbed.ReactViewAdobe;
31-
30+
31+
console.info("ReactAdobeEMbed",(global as any).ReactAdobeEmbed)
32+
const ReactViewAdobe = (global as any).ReactAdobeEmbed?.ReactViewAdobe;
3233
return (
3334
<section className="container section">
3435
<div className="row ws-m">
@@ -44,7 +45,7 @@ export default function CDN() {
4445
This approach involves loading the component as an independent script within the initial HTML page load, effectively integrating it into the HTML DOM environment. This method not only reduces the space required by the web application, thereby enhancing its load speed, but also leverages the benefits of distributed loading. By loading distinct components of the web application through separate network requests, we can maximize efficiency. In this instance, the react-adobe-embed component is sourced from a CDN as a separate network request, distinct from the main web application. This effectively allows the web application to load in two concurrent parts, or at least simulates this effect, thanks to the inherent multi-threading capabilities of computer systems.
4546
</p>
4647
{
47-
componentDidUpdate && componentDidMount && ReactViewAdobe && (<ReactViewAdobe
48+
componentDidUpdate && componentDidMount && (<ReactViewAdobe
4849
clientId={getClientId()}
4950
url="https://raw.githubusercontent.com/ZipingL/dna/main/23andMe_Ancestry_Book.pdf"
5051
debug={true}

rollup.config.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export default [
3333
format: 'umd',
3434
name: 'ReactAdobeEmbed',
3535
exports:"named",
36-
extend: true,
3736
sourcemap: true,
3837
globals: {
3938
react: 'React',
@@ -42,15 +41,15 @@ export default [
4241
},
4342
{
4443
file: packageJson.main,
45-
name: 'ReactAdobeEmbed',
44+
4645
format: 'cjs',
4746
...outputCommonConf
4847
},
4948
{
5049
file: packageJson.module,
5150

5251
format: 'esm',
53-
52+
5453

5554
},
5655
],

0 commit comments

Comments
 (0)