2
I am using Google Chrome as a browser and when I try to run the code, this error appears. And I saw that in the HTML file I can use type="module", however, two other errors appear. The first error is without type="module", and the bottom two are with type="module"
Uncaught Syntaxerror: Unexpected token {
Access to script at 'file://C:/Users/Vagner%20Wentz/Desktop/cursoes6/main.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for Protocol schemes: http, data, Chrome, Chrome-Extension, https.
GET file://C:/Users/Vagner%20Wentz/Desktop/cursoes6/main.js net:ERR_FAILED
//funcoes.js
export function soma(a, b) {
return a + b;
}
//main.js
import { soma } from './funcoes.js';
console.log(soma(1, 2));
You’re trying to open directly in the browser or the app is running on some web server?
– Douglas Teles
I’m using a webpack server that Diego from rocketseat taught to install
– Vagner Wentz
Add what is necessary to reproduce your problem in the question, otherwise it is difficult
– Sorack