Reputation: 87
We have a single page web application that loads modules on demand for different parts of the app if needed. It uses native ECMAScript import and no module bundlers like Webpack or RequireJS. I was not able to use the library this way and don't want to introduce another library just to be able to load this when browsers have great support for modules natively. If anyone could share an example of how to use it (e.g. a JSFiddle), I would be grateful. All the example codes show import with no extension in the module name, which simply leads to error in the browser (Chrome 77 currently), e.g.:
In examples:
import * as monaco from 'monaco-editor';
What I've tried:
import * as monaco from '/modules/monaco-editor/esm/vs/editor/editor-main.js';
Any idea?
Upvotes: 1
Views: 426
Reputation: 2307
I am not sure if this answers your question:
I don't think it it is possible to just use module import, since webpack features like css import are used.
But you could use a tool like @pika/web to generate modules, which should be importable.
Upvotes: 1