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

350
Visualizações
export default was not found; module export not working

with encore webpack, I do add a js file:

Encore
.addEntry('js/request', './assets/js/request.js')
.cleanupOutputBeforeBuild()
.disableSingleRuntimeChunk()
.splitEntryChunks()
...

Inside the request.js, I import a custom module:

import Request from './request';

console.log(Request);
window.Request = Request;

Which is exported in request/index.js:

export default () => ({
    url: null,
    options: { method: 'GET' },
    response: null,
    load() {
        ...

Pretty straight forward actually. BUT - when I compile this, I get a warning:

warning in ./assets/js/request.js

"export 'default' (imported as 'Request') was not found in './request'

And undefined is logged for that console.log(Request); command.

Usually this happens, when you don't export as default but I do and somehow don't? This doesn't make sense at all for me. I'm pretty new to webpack and couln't find a helpful hint so far...

Anyone an idea what I'm doing wrong?

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Oh man, I've put a request.js and a request/index.js into the same folder. So when I import ./request inside request.js, its gonna import itself due to the hierarchy of the import file detection.

Now I will just put all the files into a separate folder /entries and will be able to import ../request. Importing explicitly import ./request/index.js will also work.

I guess this just has to happen once, when you start with modules, webpack and stuff...

about 4 years ago · Santiago Gelvez 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