Problem with current Version of Parcel

Hi,

I have a problem running an older Project of my collegue (last successful run in December 2021).

In our package.json we had declared:

"devDependencies": {
    ...
    "parcel": "next",
    ...
},

running it now (February 2022), it automatically adds in the following line:

 "devDependencies": {
    "@parcel/transformer-image": "^2.0.0-rc.0",
    ...
    "parcel": "next",
    ...
}

and with that, it ran into an error:

× Build failed.

@parcel/transformer-js: Browser scripts cannot have imports or exports.

i tried removing the "@parcel/transformer-image": "^2.0.0-rc.0",
and setting "parcel": "^2.0.0",
But that leads into the same error.

Is the error even about the version of parcel,
or could it be something completely different?

As mentioned, in december everything worked fine.
Now that i cloned the Git-Repo and installed the npm to my clone of the project it gets the error.

Hi!

Depending on tags like next does create these situations where the build stops working, this is an unfortunate fact of the npm ecosystem. There are two ways to proceed as far as I can see: you can use npm ci instead of npm install on a fresh checkout of your colleague’s package-lock.json to try and get the same result they did last December. If that works, you can note down the chosen parcel version and place that in your devDependencies instead of next. The other way is to perform the migration to Parcel v2. It looks like the issue you’re currently encountering is discussed in the migration guide.

Regards,

Roland

1 Like

I could solve it this way:

I went back to "parcel-bundler": "^1.12.3",
did a npm audit fix

and changed all –dist-dir to –out-dir:

"scripts": {
   "ui:bde-terminal:start": "parcel serve src/bde-terminal/public/index.html --out-dir build/bde-terminal/debug --port 1234 --host localhost",
   ...
}

It is not the ideal way. But I haven’t seen any issues so far.

Great to hear! Looks reasonable to me.

1 Like