swansontec/rfc4648.js

Error while importing .mjs file.

devpedroleitao opened this issue · 2 comments

If you try to use the built index.mjs file from the lib it will not work.
The reason is that it tries to import the default from index.js

default-import
A simple solution is adding at the end of the file index.ts the following:

export default codec;

This problem is also related and causes to: storybookjs/storybook#22542

I have created a PR to resolve this issue: #32

I've noticed that the rollup-plugin-mjs-entry approach (which is also the official Node.js suggested approach) doesn't actually work well with other tools outside the Node.js ecosystem.

What does work is simply producing a plain CJS build for legacy Node.js setups, and then producing a separate MJS build for the rest of the world. This gets rid of all the confusion.

I will try to get a coworker to review the PR, but if you want to take a look and maybe try it out, that would be fine too.

This should be fixed in v1.5.3