You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is not a bug report. (please use a different template for reporting a bug)
This issue is not a duplicate of an existing issue. (please use the search to find existing issues)
Description
Actually, the only way for the TypeScript worker to pick up added libraries via setExtraLibs or addExtraLib is by using the main or typings fields inside the package.json file, or without a package.json, by using my-lib/some-file.js or my-lib/dist/some-file.js.
It works perfectly with the legacy method, but not with the newer exports field, which is very useful for achieving this kind of layouts:
Then we can import like this: import 'my-lib/foo';.
This is also better than using barrel files, which are becoming an anti-pattern, because of the side-effects risks, for bundlers, browsers, CDNs…
I'm not 100% sure but all ATA (automatic types acquisition) mechanisms I tried are randomly breaking on some packages, maybe because of this limitation.
Actually with Monaco, it's not possible to consume a library subparts if it's under a dist., without resorting to single entry point with a barrel, or full, sound paths.
This is problematic because since Node 12, a lot of NPM packages are adopting the new practice while abandoning the older one, for legitimate reasons.
Context
Description
Actually, the only way for the TypeScript worker to pick up added libraries via
setExtraLibs
oraddExtraLib
is by using themain
ortypings
fields inside the package.json file, or without a package.json, by usingmy-lib/some-file.js
ormy-lib/dist/some-file.js
.It works perfectly with the legacy method, but not with the newer
exports
field, which is very useful for achieving this kind of layouts:Then we can import like this:
import 'my-lib/foo';
.This is also better than using barrel files, which are becoming an anti-pattern, because of the side-effects risks, for bundlers, browsers, CDNs…
I'm not 100% sure but all ATA (automatic types acquisition) mechanisms I tried are randomly breaking on some packages, maybe because of this limitation.
Actually with Monaco, it's not possible to consume a library subparts if it's under a dist., without resorting to single entry point with a barrel, or full, sound paths.
This is problematic because since Node 12, a lot of NPM packages are adopting the new practice while abandoning the older one, for legitimate reasons.
Monaco Editor Playground Link
Monaco Editor Playground Code
The text was updated successfully, but these errors were encountered: