Good day all,
With Laravel Mix I'm trying to install Twemoji — among other modules — using Node.
I'm getting console errors, indicating that the dependencies aren't loaded correctly.
For instance: TypeError: t.parse is not a function. (In 't.parse(document.body)', 't.parse' is undefined)
Twemoji was installed as follows:
npm install twemoji
require('twemoji');
to my JS file that's going to be mixed by Laravelnpm run production -- --watch
)Another module, Datepicker, is running just fine. It was imported the same way and is imported through require('@chenfengyuan/datepicker');
in the same file.
My package.json:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.18",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"jquery": "^3.3.1",
"laravel-mix": "^2.0",
"lodash": "^4.17.4",
"popper.js": "^1.12",
"vue": "^2.5.7"
},
"dependencies": {
"@chenfengyuan/datepicker": "^1.0.0",
"chart.js": "^2.7.2",
"gulp": "^3.9.1",
"signature_pad": "^3.0.0-beta.3",
"twemoji": "^11.0.1"
}
}
Any help to get Twemoji working properly is much appreciated. Thank you in advance, and have a good evening.
Yours, Thierry
I changed require('twemoji');
to var twemoji = require('twemoji/2/twemoji.npm.js');
That's that. But my opinion is that require('twemoji');
should work as well.