Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
Is it possible to load a UMD module via script tag from a CDN and use it in a React component instead of importing it the usual way?

I want to use this package but it's extremely large and is adding a lot of bloat to my bundle. Due to some office restrictions I'm not able to set up lazy loading/chunking via webpack at the moment.

I found a CDN for the above lib:

https://cdn.jsdelivr.net/npm/@react-pdf/renderer@1.5.3/dist/

But I'm not sure how to use it. Like which of these many files should I load? All of them? and will the exports that I was able to access before be available as variables on the window object?

I never loaded something I needed in a React component via CDN like this. Here's what the code looked like when importing the usual way:

import { pdf, Document, Page, Image, Link } from '@react-pdf/renderer';

<Document title="hello" author="world">
  <Page style={styles.page}>
   // etc...
  </Page>
</Document>

How can I still use the lib if loading from CDN?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda