Import error! need help

i want to import data from firebase.js to purchase.js ( nothing of much importance), but i get this error:

import { firebase } from ‘…/firebase.js’;

^

SyntaxError: Unexpected token {

and when i try import firebase from “…/firebase.js” it errors this:

import firebase from ‘…/firebase.js’;

^^^^^^^^

SyntaxError: Unexpected identifier

This works on localhost but not glitch!

Hello, we will need to see all of your code to give help.

erm… You dont…

I think we do, its impossible to give assistance from just an error message.

But, the issue is that glitch doesnt identify importing as a method of getting
data… so i want to know why

I’m sorry, but I can’t be of much help if I can’t see your code.

also read the last bit, works on local host( the same code)

i dont want to share bc it has lots of personal info

You could just share a snippet of the part with the error here with personal info removed.

its just importing data from two scripts, ill give you an example:

script1:

data{
data1: “nice”
data2:“cool!”
}

export default data;

script 2:
import { data } from “./script1”

^^^ that is erroring

What node version are you using? iirc ES imports were added in node 12. If you’re not sure how to check that please send the “engines” line of your package.json file

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.