Fork me on GitHub
#clojurescript
<
2021-10-14
>
agilecreativity02:10:02

Is there a template library targeting ClojureScript similar to https://github.com/yogthos/Selmer?

borkdude09:10:48

You can probably also use an existing JS one, there's plenty of choice in the JS ecosystem for this

borkdude09:10:58

Handlebars, mustache ...

Simon10:10:28

I encounter an error when trying to use this javascript library TypeError: module$node_modules$react_easy_emoji$index.default is not a function

borkdude10:10:21

Can you do (.log js/console reactEasyEmoji)

p-himik10:10:26

Probably the require is wrong, the :default part.

Simon10:10:01

(.log js/console reactEasyEmoji) => nil

Simon10:10:10

var replaceEmoji = require('./lib/replaceEmoji'),
	makeTwemojiRenderer = require('./lib/makeTwemojiRenderer')

module.exports = function reactEasyEmoji (element, optionsOrFn) {
	var render = (typeof optionsOrFn === 'function') ? optionsOrFn : makeTwemojiRenderer(optionsOrFn)
	return replaceEmoji(element, render)
}

Simon10:10:35

i looked into node_modules to see how it was exported. and it seems like it is a default export

borkdude10:10:36

This is an ES6 import

borkdude10:10:42

you are dealing with commonjs probably

borkdude10:10:47

so you don't need the :default I think

borkdude10:10:20

just leave the default out

Simon10:10:07

like this?

p-himik10:10:15

:as

🙌 1
p-himik10:10:26

Or :refer.

borkdude10:10:00

indeed, use :as instead of :default

🙌 1
p-himik10:10:08

The table that you saw in shadow-cljs documentation is but a small part of the section on imports. The section itself has more pertinent information.

borkdude10:10:13

and then log the object to see what's in there

Simon10:10:27

seems to work 🥳 just double checking

p-himik10:10:49

Just in case - that logging statement simply returns nil . It probably prints out the function itself somewhere else.

Simon10:10:39

Yes it works! Now there is emoji support for all browsers! 🙂

👍 1
Simon10:10:48

Yes you are right:

Simon11:10:29

> The table that you saw in shadow-cljs documentation is but a small part of the section on imports. The section itself has more pertinent information. @U2FRKM4TW What section are you referring to?

Simon11:10:07

Yes I see now the section on CommonJS.

achikin15:10:29

I always start with [react-easy-emoji] and then (react-easy-emoji/reactEasyEmoji "hey")

👍 1
Simon15:10:14

Does that work when you need quotes around an npm library? @U3A7Z18JZ

achikin00:10:06

@U024A5W9WBG I didn’t try that usually works without quotes