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

Provide ESM modules #109

Open
maasha opened this issue Oct 25, 2023 · 4 comments · May be fixed by #126
Open

Provide ESM modules #109

maasha opened this issue Oct 25, 2023 · 4 comments · May be fixed by #126

Comments

@maasha
Copy link

maasha commented Oct 25, 2023

The related azure-devops-extension-sdk library kindly provides ESM modules that works with Vite.

I suggest that azure-devops-extension-api does the same!

@reed-lawrence
Copy link

This package is broken out-of-the-box without ESM in Angular. Angular imports the azure-devops-extension-sdk from the minified ESM, this module references the SDK.js meaning that two different modules are created by webpack, leading to the error: The AzureDevOps SDK is already loaded...

aloisklink added a commit to aloisklink/azure-devops-extension-api that referenced this issue Feb 11, 2024
The `node buildpackage.js` script now creates a `./bin/esm` folder,
which contains an ESM version of this package.

I've disabled minification for this folder, since I don't think it's
very useful, and it just makes the package larger.

We use https://nodejs.org/api/packages.html#conditional-exports
to automatically map files to the ESM version when appropriate.

The ESM version will work with most bundlers. However, since it's
missing file-extensions (e.g. it uses `export * from "./Client";`
instead of `export * from "./Client.js";`), some stricter ESM programs
will not yet work with it.

Fixes: microsoft#109
@aloisklink aloisklink linked a pull request Feb 11, 2024 that will close this issue
aloisklink added a commit to aloisklink/azure-devops-extension-api that referenced this issue Feb 11, 2024
The `node buildpackage.js` script now creates a `./bin/esm` folder,
which contains an ESM version of this package.

I've disabled minification for this folder, since I don't think it's
very useful, and it just makes the package larger.

We use https://nodejs.org/api/packages.html#conditional-exports
to automatically map files to the ESM version when appropriate.

The ESM version will work with most bundlers. However, since it's
missing file-extensions (e.g. it uses `export * from "./Client";`
instead of `export * from "./Client.js";`), some stricter ESM programs
will not yet work with it.

Fixes: microsoft#109
aloisklink added a commit to aloisklink/azure-devops-extension-api that referenced this issue Feb 11, 2024
The `node buildpackage.js` script now creates a `./bin/esm` folder,
which contains an ESM version of this package.

I've disabled minification for this folder, since I don't think it's
very useful, and it just makes the package larger.

We use https://nodejs.org/api/packages.html#conditional-exports
to automatically map files to the ESM version when appropriate.

The ESM version will work with most bundlers. However, since it's
missing file-extensions (e.g. it uses `export * from "./Client";`
instead of `export * from "./Client.js";`), some stricter ESM programs
will not yet work with it.

Fixes: microsoft#109
@vs4vijay
Copy link
Member

Is there any progress on this issue? Additionally, this module is not compatible with ViteJS. We would like to make it compatible with ESM, do you have any plans for that?

@maasha
Copy link
Author

maasha commented Mar 15, 2024

@aloisklink
Copy link

If you are interested, I have a PR open that seems to work with ViteJS: #126.

You can try it out by running npm install github:aloisklink/azure-devops-extension-api#2635bb031bb1870bf5de2c2ba31e858139543117 (it's basically that PR, except I've added an npm prepare script, so that you can install it directly from a git repo).

It hasn't been updated for a while, though, it's still based of v4.229.0, which is a few months old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants