nodejs / import-in-the-middle

Like `require-in-the-middle`, but for ESM import
https://www.npmjs.com/package/import-in-the-middle
Apache License 2.0
72 stars 27 forks source link

Acorn parser does not support import attributes #105

Open timfish opened 5 months ago

timfish commented 5 months ago

The older import assertion syntax works:

import coolFile from './something.json' assert { type: 'json' }

But acorn does not appear to support the newer import attribute syntax and it will not get added until Stage 4:

import coolFile from './something.json' with { type: 'json' }

PR #104 actually works around this issue by falling back to the parent loader when parsing fails.