Closed peacepostman closed 4 years ago
@peacepostman Do you solve this problem? I met the same problem.
Humm, actually yes but its more a trick than a permanent solution :D
In package.json "postinstall": "node ./build-tools/clear-emoji-file.js"
Then the target script :
const fs = require('fs')
try {
var rootDir = process.cwd()
var file = `${rootDir}/node_modules/emoji-mart/data/all.json`
fs.writeFileSync(file, '{}', 'utf8')
console.log('Emoji-mart all.json file is now empty')
} catch (error) {
console.error(error)
}
It's possible to use the nimble picker without including the JSON in the JavaScript file itself. In fact this is probably a good idea, since it's better for performance to use JSON.parse()
instead of directly inlining.
Here is an example of how to do it. Basically instead of doing
import data from 'emoji-mart/data/emojione.json'
You would do:
const data = await (await fetch('/some/static/path/emojione.json')).json()
Then you would host the JSON file wherever you host your static data files. Or put it in IndexedDB or wherever you like. :)
Hello,
I know that this issue seems to be fixed now but i am still struggling to remove all.json from our webpack final build.
I am calling the picker via this snippet
And I am calling the emoji renderer via this snippet
Did any of you have any idea why my final build looks like this
Best regards,