mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 05:50:11 +01:00
Merge 2d605304f5 into ec78a33c7b
This commit is contained in:
commit
2f25a40bce
5 changed files with 7 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
(function () {
|
||||
// create div to avoid needing a HtmlWebpackPlugin template
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import * as monaco from 'monaco-editor';
|
||||
|
||||
// expose the monaco API as a global for tests
|
||||
window.monacoAPI = monaco;
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ If using Webpack 4 or lower, it is necessary to use the file-loader instead of A
|
|||
|
||||
```js
|
||||
import * as monaco from 'monaco-editor';
|
||||
// or import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
// if shipping only a subset of the features & languages is desired
|
||||
|
||||
monaco.editor.create(document.getElementById('container'), {
|
||||
value: 'console.log("Hello, world")',
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ function createLoaderRules(
|
|||
};
|
||||
return [
|
||||
{
|
||||
test: /esm[/\\]vs[/\\]editor[/\\]editor.(api|main).js/,
|
||||
test: /esm[/\\]vs[/\\]editor[/\\]editor.main.js/,
|
||||
use: [
|
||||
{
|
||||
loader: INCLUDE_LOADER_PATH,
|
||||
|
|
|
|||
|
|
@ -26,14 +26,16 @@ export const pitch: PitchLoaderDefinitionFunction<ILoaderOptions> = function pit
|
|||
return loaderUtils.stringifyRequest(this, request);
|
||||
};
|
||||
|
||||
// editor.main.js contains all features and languages, replace it with requested features, languages and editor.api.js
|
||||
const apiRequest = remainingRequest.replace(/editor\.main\.js$/, 'editor.api.js');
|
||||
return [
|
||||
...(globals
|
||||
? Object.keys(globals).map((key) => `self[${JSON.stringify(key)}] = ${globals[key]};`)
|
||||
: []),
|
||||
...pre.map((include: any) => `import ${stringifyRequest(include)};`),
|
||||
`
|
||||
import * as monaco from ${stringifyRequest(`!!${remainingRequest}`)};
|
||||
export * from ${stringifyRequest(`!!${remainingRequest}`)};
|
||||
import * as monaco from ${stringifyRequest(`!!${apiRequest}`)};
|
||||
export * from ${stringifyRequest(`!!${apiRequest}`)};
|
||||
export default monaco;
|
||||
`,
|
||||
...post.map((include: any) => `import ${stringifyRequest(include)};`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue