Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A quick PR to improve the DX (Developer Experience) for ES Modules (using the
importkeyword).Right now, if you use
disposable-email-domainsusingimportin Node.js, you receive an error:Error message:
$ node index.js node:internal/errors:465 ErrorCaptureStackTrace(err); ^ TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///home/runner/RepentantTransparentAudacity/node_modules/disposable-email-domains/index.json" needs an import assertion of type "json" at new NodeError (node:internal/errors:372:5) at validateAssertions (node:internal/modules/esm/assert:82:15) at defaultLoad (node:internal/modules/esm/load:24:3) at ESMLoader.load (node:internal/modules/esm/loader:407:26) at ESMLoader.moduleProvider (node:internal/modules/esm/loader:326:22) at new ModuleJob (node:internal/modules/esm/module_job:66:26) at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:345:17) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:304:34) at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:82:21) { code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING' }You can resolve this error using the
{ type: 'json' }import assertion as shown below, but this is still experimental:It shows a warning in Node.js 18.12.1 and is not supported at all in older versions:
This PR allows for usage of the simpler
importsyntax without the import assertion.