-
Notifications
You must be signed in to change notification settings - Fork 255
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
Add rollup & support ES modules #188
Add rollup & support ES modules #188
Conversation
Couldn't find your package on npm, can you share a link? Also, there is a npm package which is a Angular wrapper for this library: https://www.npmjs.com/package/@ngx-countries/countries |
@KingDarBoja I didn't publish a package, but you can use
in |
Hey @hansottowirtz, can you update the PR with latest changes from master? |
ebad3be
to
d593bb7
Compare
@KingDarBoja done 🙂 |
It seems like require('i18n-iso-countries/langs/nl') only started working somewhere after Node require('i18n-iso-countries/dist/langs/nl.json') and this syntax will also work in later versions of Node. |
installation fails on Windows: npm ERR! > make build npm ERR! /usr/bin/bash: make: command not found` And doesn't work with yarn. |
any plans to merge this into master at some point? |
@bschnabel I don't think that the work here is done. More like a WIP. Correct me if I'm wrong @hansottowirtz ? |
This is a WIP. Closes #186.
It adds Rollup and converts the source files to ES modules. When using ES modules in Node, it is not possible to import JSON files. Rollup therefore compiles the
.json
files to.mjs
and.js
files.codes.json
is bundled in every distributed file, andentry-node.mjs
bundles all languages into one file.It makes it possible to do the following (from Node 13+, Webpack 5):
or
I'm using it on our Angular 10 website and it works (as Angular CLI uses Webpack 4, I still need to import
i18n-iso-countries/dist/langs/en
).Anyone can install this branch with NPM by running the command below. I also added a prepare script, which builds the code if the package is being installed from Github.
More testing is needed before merging this PR, with multiple node versions and with Webpack 5.