Why not connect the module or how to do it?

've seen too many examples of view and react, and decided to try it as well to share everything.
Why does not want to connect and gives an error?
Cannot use the import statement outside of a module

there is a file main.js
there are in the folder, the folder modulein which there are filespaint.js

export class PAINT {

 constructor(name) {
 this.name = name;

 naming() {

import PAINT from "modul/paint.js";
let uazik = new PAINT("uazik");

And how or is it better to do it?
To resedent code to pieces.
April 7th 20 at 10:39
1 answer
April 7th 20 at 10:41
Specify the type of the script:
<script type="module" src="main.js">
No server can be accessed through a modular system or what's the problem?
Access to script from origin 'null' has been blocked by policy CORS: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
- arden.Johnst commented on April 7th 20 at 10:44
@arden.Johnst, All the way. - Randi commented on April 7th 20 at 10:47

Find more questions by tags JavaScript