Library Upgrades and Updated Module Format
This upgrades to the latest TypeScript version and updates the output to target ES6 and use ES6 modules. Based on my research, this requires node.js version 14, so I've updated the required node version in the package.json to match.
I've published this version with a beta tag as [email protected]. If anyone gives it a test, please let me know if it works/doesn't work for you.
Fixes #18.
@becseya This PR was meant to fix #18, but I want to make sure it will work in all cases before I publish it. I've published [email protected] with your changes that are in v3.3.0 as well as the updates to the module format. If it works, I'll make this v4. If not, I'll publish a second copy of the library that uses the module format instead.
Unfortunately 4.0.0-beta4 breaks my application with error SyntaxError: Cannot use import statement outside a module
when attempting to run it.
I've rebased the changes of #19 to 3.2.0 and I'm getting the same error, so I think #20 is unrelated of this issue.
I don't have much experience with node build systems, so it's possible that I'm doing something wrong.
@becseya Thanks for the checks and useful feedback. I had a suspicion that this change might be problematic, but didn't have a good project to test it in. I think I'll separate out an nmea-simple-module package to address #18 so current users aren't affected by this.
Some more fixes in https://github.com/101100/nmea-simple/pull/25 to help with ESM. At the very least, we need dist/index.js to be marked as using modules. The two approaches are:
- rename it to
index.mjs - set
package.json#type: "module"(either in the top levelpackage.jsonor in somedist/package.json).
I went with the second since I think it's the cleanest.
Instead of releasing a second package, you can make import, require use different entry points.