optic
optic copied to clipboard
use esm dynamic imports for latest-version and update-notifier
🍗 Description
What does this PR do? Anything folks should know?
unreverts https://github.com/opticdev/optic/pull/2465
the reason this was failing is because babel was transpiling dynamic imports (await import()
) into require()
which throws the error Error [ERR_REQUIRE_ESM]: require() of ES Module
. Excluding { exclude: ['proposal-dynamic-import'] }
fixes this
Created a prerelease 0.50.17-0
to test this out - to test:
With binary distr
- [ ] Can run cli (hits the update notifier path) - broken - need to investigate
- errors:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'update-notifier' ... Did you mean to import update-notifier/index.js?
-
const updateNotifier = (await import('update-notifier/index.js')).default; TypeError: Invalid host defined options
- errors:
- [ ] Sanity check ruleset upload / import (there was weird things with our import handling with custom ruleset uploads that i want to double check)
With npm package
- [x] Can run cli (hits the update notifier path)
- [ ] Sanity check ruleset upload / import (there was weird things with our import handling with custom ruleset uploads that i want to double check)
📚 References
Links to relevant docs (Notion, Twist, GH issues, etc.), if applicable.
- https://stackoverflow.com/a/63563486
👹 QA
How can other humans verify that this PR is correct?