Closed thomas-darling closed 3 years ago
I am sorry this is causing problems. What is going on here is that tslib main is now configured to point at the ES module entry point - tslib.es6.js
. This was done because systemjs 0.20 did not seem to be detecting the module type of the UMD version correctly (see https://github.com/frankwallis/plugin-typescript/issues/199) and also it will enable rollup support to remove unused helper functions when bundling.
The workarounds I can think of are: a) Provide a local override which points tslib main back to tslib.js b) Change the registry to point main back to tslib.js but set the format of the file (probably to cjs?)
When you say SystemJS refuses to load the file, do you means it errors with 'export is not defined' or similar?
@frankwallis I've also been playing with this for a few hours. Here's what I have so far in regards to pointing to a different file:
packages: {
"tslib": {
"main": "tslib.js",
"format": "amd"
}
}
This loads, however SystemJS doesn't seem to be executing the file (errors along the lines of tslib_1.__metadata is not a function
). I've tried playing with the format
as well, but it doesn't help.
With tslib@1.5.0
on my Windows PC jsm_packages/tslib@1.5.js
is using require
and on macOS it appears to be using the ES6 above.
How did I end up with them differing with the same version of tslib
and jspm
?
Edit Ah, I see the registry has been updated!
Thus far, the only way I have managed to force it to work, was by
adding "npm:tslib@1.5.0": "jspm_packages/npm/tslib@1.5.0/tslib"
to paths
in config.js
and removing "format esm";
from the top of jspm_packages/tslib@1.5/tslib.js
.
But obviously, this is not an acceptable fix, as we can't rely on modifying files like that - and I don't understand why it's adding "format esm";
to that file in the first place - it seems to be messed up.
I have created the above pull request which I hope will resolve this.
Many apologies for the issues this caused. jspm/registry#1041 has now been merged. Please let us know if you continue to experience issues
Going to close this issue as it looks sorted 👍🏻
@frankwallis @aluanhaddad We're currently having some critical issues, which I think are related to https://github.com/jspm/registry/pull/1040.
Basically, when installing
tslib
from NPM using JSPM v0.16.52, it seems to get confused about which file is an ES module and which isn't. When we did ajspm install
this morning, it somehow ended up creating ajspm_packages/tslib@1.5.js
file containing this:Where previously, it contained this:
Also, we end up with
"format esm";
at the top ofjspm_packages/tslib@1.5/tslib.js
, where before it was"format cjs";
. This makes no sense to me, as that file is clearly not an ES module, and System.js refuses to load this file, unless we enable client-side transpilation - which we won't.I'm not really sure what is happening here, but it's breaking everything for us, which is a rather big problem. Do you know what is going on here, and if so, can you provide a workaround until it's fixed? We can't update to the latest JSPM just yet, for various reasons, so we absolutely need this to work for JSPM 0.16.