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

253
Visualizações
Parcel load typescript package into a html file (CANT IMPORT)

So I have wasted like 6 hours on this.

I need to load a typescript file with a few dependancies into a vanilla js project.

This is what I do.

  1. install all dependancies in the typescript project.
  2. yarn parcel "filepath"
  3. project compiles succesfully into dist folder
  4. move the compiled file (index.js, the only other file is index.js.map) into the vanilla js project.
  5. [The issue] Try to import the parcel file into my vanilla js project. here is what i tried.
import {myFunction} from '/index.js'; //crashes site
import myFunction from '/index.js'; //crashes site
import * from '/index.js'; //symbol not found

import * as things from '/index.js'; 
//console.log(things) prints: Module {Symbol(Symbol.toStringTag): 'Module'} Symbol(Symbol.toStringTag): "Module"

import("./index.js").then(function (myFunction) {
 console.log(myFunction);
});
//prints: Module {Symbol(Symbol.toStringTag): 'Module'} Symbol(Symbol.toStringTag): "Module"

I also have tried export default in the typescript with all the attempts above.

I appreciate any advice.

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