I can't use emoji.js

82
March 29, 2021, at 01:30 AM

I'd like to use https://github.com/iamcal/js-emoji to convert :emoji inside colons: into actual emoji, like how it is implemented in Discord and Slack.

I installed the library with npm i emoji-js
Then I put the following in the head of my HTML:

<link href="emoji.css" rel="stylesheet" type="text/css" />
<script src="emoji.js" type="text/javascript"></script>

And the following at the top of my script:

var emoji = new EmojiConvertor();

However, not only does the rest of my script not work after this, I also get the following errors in my dev console:

The resource from “http://localhost:3001/emoji.css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
The resource from “http://localhost:3001/emoji.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)

Uncaught ReferenceError: EmojiConvertor is not defined

Does anyone know how I can implement this library?

Answer 1

You should include the full path to the library in the link and script tags.

<link href="./node_modules/emoji-js/lib/emoji.css" rel="stylesheet" type="text/css" />
<script src="./node_modules/emoji-js/lib/emoji.js" type="text/javascript"></script>
READ ALSO
Getting the area/place bounds of a LatLng as polygons in Android Maps

Getting the area/place bounds of a LatLng as polygons in Android Maps

Simply I want to get the area which user clicks a latLng in a map and highlight it by getting polygons or anything like the image below, I searched but I didn't find any API provide thatany help?

94
VB.net Connection Failed database MySql

VB.net Connection Failed database MySql

I have problems when running software that has been developed using Visual Basic and mysql databaseThe connection runs perfectly on the codingan, but the problem is that the database connection is often lost when running the application at the time of data access,...

88
How to do performant insert if not exist in hibernate with postgres?

How to do performant insert if not exist in hibernate with postgres?

I'm currently designing an image tag systemThere's a n

125
Cooldown, connected to MongoDB

Cooldown, connected to MongoDB

So this is my "daily" commandAnd I want to have mongo connected so it detects if a user has used the command within 24hrs of previously using it

93