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

219
Visualizações
How can I import a JS file with special characters in it's name in React and JSX?

How can I import a JS file with special characters in it's name in React and JSX?

I can

import { tomorrow} from 'react-syntax-highlighter/dist/esm/styles/hljs';

(the folder contains tomorrow.js and tomrorrow-night.js)

but I can't:

import { tomorrow-night} from 'react-syntax-highlighter/dist/esm/styles/hljs';

I don't think destructuring works here because it's an import statement.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

you can try as

import * as Highlighter from 'react-syntax-highlighter/dist/esm/styles/hljs';

const TomorrowNight = Highlighter[`tomorrow-night`];
about 4 years ago · Juan Pablo Isaza Relatório

0

How about using the import * as blah import? That gives you an object that you can then lookup any string in.

import * as tmrw from from 'react-syntax-highlighter/dist/esm/styles/hljs';
const tmrw_night = tmrw['tomorrow-height']
about 4 years ago · Juan Pablo Isaza Relatório
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