microsoft / microsoft/monaco-editor
ES Modules (vs Webpack)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
The introduction of the /esm/ distribution has been especially helpful for people who do not subscribe to specific or conventional building pipelines. While tools like Webpack are very popular, their concepts of ES Modules still go against the grain of what ECMAScript modules are really all about.
At this point, all the existing examples and documents seem to be talking about "Webpack"ing tree-shakable bundles that retain ES module syntax that translate into native ModuleNamespace in supporting browsers. (AMD is not ES modules, so is Parcel IMHO — please correct me if I am wrong)
The only thing is that if I created an index.html which loads monaco directly "monaco-editor/esm" and ran "http-server" without Webpack, something like this:
<div id=container>
</div>
<script type=module>
import '/node_modules/monaco-editor/esm/vs/editor/editor.all.js';
import monaco from '/node_modules/monaco-editor/esm/vs/editor/editor/editor.api.js';
import '/node_modules/monaco-editor/esm/vs/language/typescript/monaco.contribution';
import '/node_modules/monaco-editor/esm/vs/language/css/monaco.contribution';
import '/node_modules/monaco-editor/esm/vs/basic-languages/css/css.contribution.js';
import '/node_modules/monaco-editor/esm/vs/language/json/monaco.contribution';
import '/node_modules/monaco-editor/esm/vs/language/html/monaco.contribution';
import '/node_modules/monaco-editor/esm/vs/basic-languages/monaco.contribution.js';
/* mum look, no handlebars, and I can almost monaco in less than 20 lines of code */
</script>
This will not work.
It does not take too much effort to get there, since honestly, you guys have done all of the hard work to almost get there.
I am sure a lot of people would like to see this work (not Webpack) nicely because it implies that people are not forced to use and subscribe to opinionated "non-standard" tools that seem to blur things for everyone who actually tries to color inside the lines.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported failure with the provided index.html, the /esm/ distribution, and a static http-server, then inspect the listed monaco-editor ESM imports. Determine what changes would make direct browser module loading work without Webpack; done would be a working equivalent of this example using native module syntax.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, webpack
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100