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
52 stars 20 forks source link

Acorn parser does not support import attributes #105

Open timfish opened 3 weeks ago

timfish commented 3 weeks 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.