Conduitry / cheap-watch

If it works, why use something else? // Mirror of https://git.chor.date/Conduitry/cheap-watch
https://conduitry.dev/cheap-watch
MIT License
69 stars 4 forks source link

fix: esm: runtime issue with importing EventEmitter: using named import #10

Closed btakita closed 3 years ago

btakita commented 3 years ago

fixes https://github.com/Conduitry/cheap-watch/issues/9

dist/CheapWatch.cjs & dist/CheapWatch.mjs are bundled in this PR. Feel free to convert back to original file names if preferred.

I'm also using the rollup-plugin-typescript2 plugin to fix a build issue inside of a pnpm multirepo with cheap-watch installed as a git submodule.

The dist/CheapWatch.mjs top line is now import { EventEmitter } from 'events'; instead of import * as EventEmitter from 'events';

btakita commented 3 years ago

Fixes https://github.com/Conduitry/cheap-watch/issues/9

benmccann commented 3 years ago

Putting "Fixes #9" in a comment won't link the PR to the issue. You need to do it in the description. Can you edit the description so that "Fixes #9" isn't in a code block or quoted or anything like that, but is just plain text

btakita commented 3 years ago

Got it. I was adding the "fixes https://github.com/Conduitry/cheap-watch/issues/9" with an indent to the commit which caused it to be quoted. Will update my process.

btakita commented 3 years ago

@benmccann Thank you for accepting this merge. I want to point out that "type": "module" was added to package.json. Is cheap-watch ready to move over to ESM by default? There is cjs & mjs handling added but I was not able to test this from a cjs module.

btakita commented 3 years ago

I updated test.js to ESM.

benmccann commented 3 years ago

I think that the important part of this has now been merged and released: https://github.com/Conduitry/cheap-watch/pull/4

Conduitry commented 3 years ago

Besides the change in #4, I don't think the other changes here are something I want to do. I don't want "type": "module" because I don't want to exclude earlier versions of Node.

If you want to install this as a Git submodule rather than using npm, I'd recommend installing the tags directly (rather than master), as they point to already-built copies of the code - e.g. https://github.com/Conduitry/cheap-watch/tree/v1.0.4