i have imported momentjs in my react app, after importing react create app is throwing following error restricting the build
./src/shared_components/quiz-player/node_modules/moment/moment.js
Line 9: 'define' is not defined no-undef
when i investigate the issue it is thrown from following line
typeof define === 'function' && define.amd ? define(factory) :
global.moment = factory()
this is due to amd module definition and since this is a third party library i have no option of resolving the issue, is there any thing that can be done to tell the webpack config to expect amd module definition or some other fix for this?
...
/* eslint no-undef: */
typeof define === 'function' && define.amd
? define(factory)
: global.moment = factory();
...
more see https://eslint.org/docs/2.0.0/rules/no-undef
You can add the following to the tsconfig.json file at the root level of your project folder:
{"skipLibCheck": true,}
This should solve the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With