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

Editing emoji file #48

Open
prasanthsd opened this issue Jun 19, 2020 · 4 comments
Open

Editing emoji file #48

prasanthsd opened this issue Jun 19, 2020 · 4 comments

Comments

@prasanthsd
Copy link

Hi,

The documentation just states to edit the file and compile using this command.

npx babel-node scripts/compile.js

I installed @babel/node and @babel/core first. In node 10 as well as 12 it didn't work. On node 10 it says "SyntaxError: Unexpected token import" and on node 12 its "SyntaxError: Cannot use import statement outside a module". Is it possible for someone to provide some help on how to get this compiled?

@rijn
Copy link
Collaborator

rijn commented Jul 1, 2020

What command you used to compile? The error should only happen when running untranspiled code. babel default preset should transpile the es6 module to require. You could also manually specify the preset.

npx babel-node --presets @babel/preset-env scripts/compile.js

@prasanthsd
Copy link
Author

I already fixed it with preset-env. But then there are syntax errors in index.js like "concat" function missing and I realized it was using a concat on an object instead of an array. Commented that out and fixed a few other stuff in the code to get that working. But I have a feeling the index.js inside emoji-data may not be the latest one. Can you please confirm?

@mauscoelho
Copy link

I followed the same steps but looks like the compiled.js file is not correct and I got an error on searching the emojis.
Did you manage to make it works @prasanthsd ?

@prasanthsd
Copy link
Author

From my notes it seems I fixed it by the following changes:

Use @babel/preset-env

In index.js comment out the following:
emojiSynonyms[k].concat(userInputEmojiSynonyms[k])

.invert()
.map((v, idx) => ({
    "keywords": v,
    "emoji_key": idx
}))

Then run npx babel-node scripts/compile.js

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