matomo-nodejs-tracker icon indicating copy to clipboard operation
matomo-nodejs-tracker copied to clipboard

Fails to build when imported in Create React App

Open turpana opened this issue 5 years ago • 2 comments

I ran into this build error deploying to heroku once I added this tracker:

Failed to minify the code from this file: 
 	./node_modules/matomo-tracker/index.js:96 
Read more here: http://bit.ly/2tRViJ9

I just copied the code into my src directory for now, but would be nice if this package was published pre-compiled.

turpana avatar Aug 18 '18 18:08 turpana

Hi, I guess this is because the module uses ES5/6 syntax, so if your client doesn't support is, you need to use something like babel to transpile it.

But nevertheless this module is just intended for nodejs, which should support the syntax. If you want to track Matomo in the browser in a react app, I guess it is easier if you use a library that is intended for it like (I didn't test them) https://github.com/joernroeder/piwik-react-router https://www.npmjs.com/package/react-piwik

Findus23 avatar Aug 18 '18 19:08 Findus23

I have no problem with a recent create-react-app, so I guess you can close this one.

Toub avatar Jan 06 '20 07:01 Toub