Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: npm resolvers default export not working as expected #16506

Closed
apollo79 opened this issue Nov 1, 2022 · 1 comment
Closed

Bug: npm resolvers default export not working as expected #16506

apollo79 opened this issue Nov 1, 2022 · 1 comment
Labels
invalid what appeared to be an issue with Deno wasn't node compat

Comments

@apollo79
Copy link

apollo79 commented Nov 1, 2022

Using the following code:

import Ajv from "npm:ajv@8.11.0";

const ajv = new Ajv();

An error occurs:

This expression is not constructable.
Type 'typeof import("file:///<user>/deno/npm/registry.npmjs.org/ajv/8.11.0/dist/ajv")' has no construct signatures. deno-ts(2351)

Strangely enough Ajv has a property default which is the default export, so the following works:

import Ajv from "npm:ajv@8.11.0";

const ajv = new Ajv.default();

The same happens with ajv-formats:
This throws:

import Ajv from "npm:ajv";
import addFormats from "npm:ajv-formats";

const ajv = new Ajv.default();

addFormats.default(ajv);

But this works:

import Ajv from "npm:ajv";
import addFormats from "npm:ajv-formats";

const ajv = new Ajv.default();

addFormats.default(ajv);
@bartlomieju bartlomieju added needs investigation requires further investigation before determining if it is an issue or not node compat labels Nov 1, 2022
@dsherret dsherret added invalid what appeared to be an issue with Deno wasn't and removed needs investigation requires further investigation before determining if it is an issue or not labels Nov 1, 2022
@dsherret
Copy link
Member

dsherret commented Nov 1, 2022

The same thing occurs with Node ESM importing this package, so this is not an issue in Deno. See here: ajv-validator/ajv#2132

Related issues:

#16458
#16475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid what appeared to be an issue with Deno wasn't node compat
Projects
None yet
Development

No branches or pull requests

3 participants