Javascript imports produce errors

Javascript imports produce errors

by Paul Diaper -
Number of replies: 1

I am developing interactive learning resources using Javacript (ES6) and HTML5.

When I test the resource on a test Apache server (WAMP) the imports of web components work fine.

However when I upload the files to Moodle the import code lines throw up an error in the browser web console.

If I paste the Classes from the import files into the one file, so that all the javascript code is in a single file with the HTML, then the 'app' works fine.


Example javascript import line:

import { SimplePointSlider } from './js/components/SimplePointSlider.js';


I can probably get around the problem by simply 'including' the web components as a 'src' rather than importing them. But that would seem like a backwards step.

Average of ratings: -