Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

281
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda