I keep getting "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.ts(1343)" when trying to use import.meta.url (as shown in Parcel docs). Yes, I have configured my tsconfig as suggested in the message (tried all 3 options).
I'm trying to dynamically load images from an assets folder using React, Typescript and Parcel 2. I have scoured the internet searching for solutions and I've read about merging and augmenting types in Typescript, but I can't seem to make it work.
@parcel/validator-typescript
), VSCode, ortsc
? Also, how is your project structured? I have atsconfig.json
file in your project with"compilerOptions": { "module": "es2020" }"
set, and usingimport.meta.url
works for me - one idea is that maybe whatever tool is throwing the error for you isn't finding yourtsconfig.json
file? – Luxuriance