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

Consider publishing a dual packaged module? #14

Open
chmac opened this issue Jan 28, 2022 · 2 comments
Open

Consider publishing a dual packaged module? #14

chmac opened this issue Jan 28, 2022 · 2 comments

Comments

@chmac
Copy link

chmac commented Jan 28, 2022

I'm trying to use this package inside oclif, but I'm hitting this error. Essentially it doesn't support loading es modules. Despite the fact that this module is TypeScript and my code is TypeScript, the modules won't play nice.

I don't fully understand the ins and outs. I guess that you're only publishing an ESM module which is the latest and greatest, and oclif is using some older module loading strategy which won't play nice.

Question, would you be open to publishing a dual build module? For inspiration, I've been able to import tsdav without issue in oclif.

@MarcelWaldvogel
Copy link
Owner

Can you tell me more about your setup and error messages so I can investigate?

@mrbrianevans
Copy link

I am also getting module errors from installing this module. Build history is public on https://app.travis-ci.com/github/mrbrianevans/social-media-export-analyser/builds.

Its really strange, I'm not sure exactly how it works, but the error message is shown below:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /home/travis/build/mrbrianevans/social-media-export-analyser/lib-testing/test/preProcessing/HtmlPreProcessing.spec.ts

It looks unrelated, but I've isolated it to using this module by checking out previous commits (that are known to work) and installing the module and immediately this error comes up.

I cloned your repo to see what could be done to fix this issue, and changing to CommonJS modules solves it for me.
That is changing tsconfig.json/compilerOptions/module to "CommonJS" and package.json/type to "commonjs".

I know ESmodules are the future and should be preferred, so if possible it would be great to do what @chmac suggested and publish both. I myself am not sure how exactly that would be done, but I think it would solve these errors.

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

No branches or pull requests

3 participants