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

280
Visualizações
SyntaxError: Cannot use import statement outside a module with shared package

I am currently working on building a shared node package between my NextJS app & Firebase Functions backend. Here is the current directory structure:

├── backend/
│   └── functions/
├── product/
└── shared/

Here is my index.ts that I export from my shared package:

import { SUPPORTED_WEBSITES } from "./websites/supportedWebsites";
import { getSupportedWebsite, addAffilateLink } from "./websites/utils";

export default { SUPPORTED_WEBSITES, getSupportedWebsite, addAffilateLink };

I then reference in firebase/functions:

import shared from "shared"

export const exampleFunc = functions.https.onCall(
   async (data, context) => {
      shared.getSupportedWebsite("amazon.com")
   }
)

I then run firebase emulators:start to try to test out exampleFunc and I get:

import { SUPPORTED_WEBSITES } from "./websites/supportedWebsites";
^^^^^^

SyntaxError: Cannot use import statement outside a module

I am currently symlinking shared to backend/functions via Lerna.

Please let me know if you have any ideas/need more clarification.

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

0

Update

I was able to fix this by compiling my shared/src files into commonjs files via tsc

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