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

363
Visualizações
Create docker image of project that uses yarn link

In my NextJS project I use yarn as the package manager and decided to use yarn link to have import aliases/absolute imports. This is a neat feature of yarn and the recommended way to use aliases if you use yarn. However, after I implemented it, my docker image creation script broke. The image creation fails on step 6, which is the actual build. Everything works beautifuly if I run yarn dev or yarn build, but docker doesn't seem to undertand I'm using aliases. Here's the script I ran the the outputs:

Scripts: docker build --pull --rm -f dockerfile -t my-ui . && docker run -d --name my-ui -p 80:80 my-ui

Outsputs:

 => CACHED [builder 1/6] FROM docker.io/library/node:10-alpine@sha256:dc98dac24efd4254f75976c40bce46944697a110d06ce7fa47e726847  0.0s 
 => [internal] load build context                                                                                                4.7s 
 => => transferring context: 2.46MB                                                                                              4.6s 
 => [builder 2/6] COPY package.json yarn.lock ./                                                                                 0.1s 
 => [builder 3/6] RUN yarn install --ignore-engines && mkdir /my-ui && mv ./node_modules ./my-ui               364.1s 
 => [builder 4/6] WORKDIR /my-ui                                                                                         0.0s 
 => [builder 5/6] COPY . .                                                                                                      15.2s 
 => ERROR [builder 6/6] RUN yarn run build

The error I get is the following: Type error: Cannot find module 'style/icons/More' or its corresponding type declarations.

This occurs right in the first component of the project. I searched and found nothing on yarn-link and docker. How do I make docker understand that style/* is an alias and be able to find the corresponding modules?

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

0

I would avoid using yarn link in this case as it should be used for development only and instead, you can use webpack alias. https://teselagen.com/blog/a-better-alternative-to-npm-yarn-link-for-front-end

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