0
I got into a problem here that I can’t solve the problem and the next:
I ran -> npm install fontfaceobserver
then went there in the code -- code.js
ai pus import --> import Fontfaceobserver from 'fontfaceobserver';
but when I do that, all functions stop working, they change color,
I did the basic functions
function teste1(){alert('teste')}
let’s assume, this function works without import, when I put the import it and all the others stop working, I will put the photo below.
Version of nodes and npm C:>Node --version v14.17.5 C:>npm --version 6.14.14
to run the project simply give a F5 in index, then it already updates with all the changes I do, do not need to build in the project
am using Visual Studio Code
Just remember, I’m a latte in this programming business so I may be making a basic mistake.
I’m trying to use this github code https://github.com/bramstein/fontfaceobserver
It is not clear if you are using a library that builds some form of the project, but the version of the nodejs you are using, depending on the version does not have native support for the command
import
.– Danizavtz
done, made the changes
– Laercio
That’s what @Danizavtz said above... check the version you’re using and the minimum version with Imports support. You need to use something to "buildar", turn into code that is accepted by current browsers. The Babel, for example.
– tadeubarbosa
I am watching the videos of Babel I will implement here, I recorded a video of the problem https://youtu.be/DyklaJoNe04
– Laercio
At last it worked, I’m new and started alone so I was doing everything without a framework, then I installed React and import worked like the image above, I still didn’t need Babel, but I’ll install Babel later. thank you all
– Laercio