-
Notifications
You must be signed in to change notification settings - Fork 132
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
Wrong exports in tslib #161
Comments
fix #162 |
The We currently use From our tests, this is working as expected. What is the actual issue you are running into? |
My problem is, I don't use a package manager, I host directly the javascript emited from typescript, and this points to "./node_modules/tslib". Now my webserver follows the resolution strategy and rewrites the import to tslib.js, cause there is no definition of "module" for the export in the spec of nodejs |
Maybe switching the package.json to type"module" would fix this? so the export with "main" and "require" should point to a comonJS module then, and the rest to es6? |
We can't change the root |
Will #171 address your needs? |
I think this would work. |
thx |
Is there hope of getting this resolved even thought #171 has a disapproval? As far as I know, We're hitting issues where we load tslib as a standard module, and get the error:
|
@rbuckton now that there is a tslib.es6.mjs file as well, could we just change things around so that file is used instead of I'm currently running into issues after upgrading to vite 6 where my unit tests are failing because the following code is generated:
But The specifics of that issue aside, if I change the tslib export map to pull in Unless I'm missing something, I think you should be able to simplify the export map to the following: "exports": {
".": {
"require": {
"types": "./tslib.d.ts",
"default": "./tslib.js"
},
"types": "./modules/index.d.ts",
"default": "./tslib.es6.mjs"
},
"./*": "./*",
"./": "./"
} That way import and require still get their own separate types and implementations, and I flipped things around to check explicitly for "require" so that you don't need to worry about non-standard things like "module" anymore and it can just be handled by the "default" case. Would you be open to this change as a PR? [Update] |
I think the "import" specifier in the exports section should also point to ES6 Version:
tslib/package.json
Line 32 in 481d352
see spec:
https://nodejs.org/api/packages.html#approach-1-use-an-es-module-wrapper
so there is no "module" specifier, but it is often used, I know. But if I want to import acording to spec, my site would load the one with "import" and then it would fail cause this is not usable by imports
The text was updated successfully, but these errors were encountered: