parcel icon indicating copy to clipboard operation
parcel copied to clipboard

export-default-from proposal is enabled

Open char0n opened this issue 5 months ago • 2 comments

Here is an example:

const from = 3;
export default from;

@parcel/transformer-js: Unexpected token ;. Expected a string literal


The code uses reserved keyword from, but in this context it's completely valid JavaScript.

char0n avatar Jan 08 '24 13:01 char0n

I'm not entirely sure why, Parcel has the export-default-from proposal enabled: https://github.com/parcel-bundler/parcel/blob/cd447dc4edaa3a6ff6b40fbfd41998656dad3515/packages/transformers/js/core/src/lib.rs#L549 and according to that, what you're seeing is the correct behaviour... https://github.com/tc39/proposal-export-default-from/issues/2

mischnic avatar Jan 08 '24 14:01 mischnic

Hi @mischnic,

Ahh, interesting that parcel is implementing Stage 1 proposals. Anyway it's clear now why it happens. Thanks! I've adopted naming changes withing the code to void situation however the proposal endup.

char0n avatar Jan 09 '24 09:01 char0n