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

291
Visualizações
How can I use absolute imports with storybook and Next.js?

In my .storybook/main.js file, I have:

 webpackFinal: async (config) => {
     config.resolve.modules = [
       ...(config.resolve.modules || []),
       path.resolve(__dirname),
     ];

     return config;
   },

But when I run my storybook, I get an error:

resolve 'components/Common/Button' in '/myprojectpath/pages'
  Parsed request is a module
  using description file: /myprojectpath/package.json (relative path: ./pages)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      /myprojectpath/pages/node_modules doesn't exist or is not a directory
      looking for modules in /myprojectpath/node_modules

Not sure what's happening. When I run the Next.js project, it loads fine.

Thanks in advance!

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

0

It looks like the setting absolute path issue: github issue

Most likely, will be solved with

path.resolve(__dirname, ".."), "node_modules"]

or

path.resolve(__dirname, "../src"), "node_modules"]
about 4 years ago · Santiago Trujillo 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