Import и export класса в js

Хочу экспортировать класс Sky - SyntaxError: Unexpected token 'export'

export class Sky {
    constructor(el) {
        this.el = el;
    }
    getImage(
        skySettings = {
        hi: false,
        hello: false
    }) {
        let gallery = [...this.el.childNodes];
        gallery = gallery.filter(item => item.nodeName === 'IMG');
        console.log(gallery, skySettings);
    }
}

Хочу импортировать его в другой файл - SyntaxError: Cannot use import statement outside a module

import { Sky } from './script';

Ответы (1 шт):

Автор решения: Qwertiy
<script type="module" src="..."></script>
→ Ссылка