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

384
Visualizações
Import file in webpack only if file exists in ES6 syntax

Basically, I need to get variable from file, otherwise to get variable from default file.

I see best solution as:

import { variable } from "file.js"; // if variable exists
import { variable } from "default.js"; // otherwise import variable from default

But if file.js not exists I get an error. And its expecting, but not needs for me in this case. Is it possible to fix it with webpack and just ignore this import if file not exists?

An import() statement isn't fit because I need import on build stage, not dynamic import at runtime.

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