I'm having a hard time importing my uikit.js in my react js component.
This is my import sample, the uikit.css works but the uikit.js provides this kind of error:
import './uikit/css/uikit.css';
import './uikit/js/uikit.js';
Line 5: 'define' is not defined no-undef
Line 5: 'define' is not defined no-undef
Line 573: 'DocumentTouch' is not defined no-undef
Line 1107: 'MSGesture' is not defined no-undef
Line 5039: Unexpected use of 'location' no-restricted-globals
Line 5043: Unexpected use of 'location' no-restricted-globals
Line 6679: Unexpected use of 'location' no-restricted-globals
This shouldn't be a problem. First of all install uikit with
npm i uikit --save
Then import it into your application as you would any other package.
If you used create-react-app
, and you are calling it in src
directory, just do
import '../node_modules/uikit/css/uikit.css'
else determine the depth and adjust the relative path accordingly
I did it by doing the following;
install uikit * npm i uikit --save or yarn add uikit --save
Go to the index.js file and include this so u can use it in any component;
import "uikit/dist/css/uikit.min.css";
or/and
import "uikit/dist/css/uikit-core.min.css";
NB: Don't forget to include the uikit javascript by including this in your index.js file too.
import "uikit/dist/js/uikit.min.js";
Hopefully, this helps!!
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