Parcel Bundler and Unexpected Identifiers/Token

Hello everyone. I have started to look at Parcel and how to use it for projects. I followed THIS tutorial but I am still having issues with the ‘import’ and ‘from’. When I use them I either receive “unexpected token” or “unexpected identifier” and I’m not sure why.

Do you have an example import line that’s failing?

It’s hard to know for certain what’s going on without seeing that

import { bro } from './bro';

Is this what you were asking for? Because this one gives the error. I can comment more if needed.

Is it the first import in the file?

parcel should by default be transpiling that code for you when you build it, dependent on settings of course into something the browser or node can run

how are you running your project? npm run dev or similar?
e.g. with something like this in your package.json:
"dev": "parcel <your entry file>",

Yes it is the first import file. I’m using yarn and the json file looks like:

"dev": "parcel src/index.html",

I was opening it in the browser and not the local host. It worked in the local host. I’m going to cry now.

Sorry for slow reply, glad you got it sorted :slight_smile: