npm-opa-wasm icon indicating copy to clipboard operation
npm-opa-wasm copied to clipboard

make this an ES module

Open srenatus opened this issue 3 years ago • 8 comments

Also from #36:

This module is based on commonjs and considering ES Modules is the standard, providing support for that would be great. Currently, working with esModuleInterop and importing like this:

import opa from "@open-policy-agent/opa-wasm";
const { loadPolicy } = opa;

srenatus avatar Dec 18 '20 13:12 srenatus

💭 Would using some clever CDN like https://www.skypack.dev/ solve this? I.e. convert to ESM on the fly?

srenatus avatar Sep 14 '21 07:09 srenatus

Parceljs.org seems like it's both able to do that and not too difficult to handle. I'll give it a try.

srenatus avatar Oct 16 '21 18:10 srenatus

@tvvignesh if you're still using this, I'd appreciate feedback on the draft PR ☝️ Does it do the trick?

srenatus avatar Oct 21 '21 19:10 srenatus

I can help with that. Are you agree to propose a PR?

jorgecasar avatar Dec 17 '21 12:12 jorgecasar

@jorgecasar yeah that would be great. When playing with microbundle (#87), it seemed like you could have both, a commonJS and an ES module. I think that's what we'd want? 🤔

srenatus avatar Dec 17 '21 12:12 srenatus

I see that tests are not working. In my case the results are: Test Suites: 5 failed, 2 passed, 7 total. I guess we have to fix test before migrate to ESM to be sure we don't break anything.

I was using nodejs 16.9.1

jorgecasar avatar Dec 18 '21 20:12 jorgecasar

So we're using 12 and 14 in CI. Is it time to enable 16? 🤔 Can you share what breaks for you? (Otherwise I'll try it next week.)

srenatus avatar Dec 18 '21 21:12 srenatus

I just run npm test and there are some issues with circular references in JSON. I will copy the full log ASAP

jorgecasar avatar Dec 18 '21 22:12 jorgecasar

Isn't this done? Hmm.

srenatus avatar Sep 14 '22 18:09 srenatus