mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +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 () {
|
(function () {
|
||||||
// create div to avoid needing a HtmlWebpackPlugin template
|
// 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
|
// expose the monaco API as a global for tests
|
||||||
window.monacoAPI = monaco;
|
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
|
```js
|
||||||
import * as monaco from 'monaco-editor';
|
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'), {
|
monaco.editor.create(document.getElementById('container'), {
|
||||||
value: 'console.log("Hello, world")',
|
value: 'console.log("Hello, world")',
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ function createLoaderRules(
|
||||||
};
|
};
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
test: /esm[/\\]vs[/\\]editor[/\\]editor.(api|main).js/,
|
test: /esm[/\\]vs[/\\]editor[/\\]editor.main.js/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: INCLUDE_LOADER_PATH,
|
loader: INCLUDE_LOADER_PATH,
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,16 @@ export const pitch: PitchLoaderDefinitionFunction<ILoaderOptions> = function pit
|
||||||
return loaderUtils.stringifyRequest(this, request);
|
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 [
|
return [
|
||||||
...(globals
|
...(globals
|
||||||
? Object.keys(globals).map((key) => `self[${JSON.stringify(key)}] = ${globals[key]};`)
|
? Object.keys(globals).map((key) => `self[${JSON.stringify(key)}] = ${globals[key]};`)
|
||||||
: []),
|
: []),
|
||||||
...pre.map((include: any) => `import ${stringifyRequest(include)};`),
|
...pre.map((include: any) => `import ${stringifyRequest(include)};`),
|
||||||
`
|
`
|
||||||
import * as monaco from ${stringifyRequest(`!!${remainingRequest}`)};
|
import * as monaco from ${stringifyRequest(`!!${apiRequest}`)};
|
||||||
export * from ${stringifyRequest(`!!${remainingRequest}`)};
|
export * from ${stringifyRequest(`!!${apiRequest}`)};
|
||||||
export default monaco;
|
export default monaco;
|
||||||
`,
|
`,
|
||||||
...post.map((include: any) => `import ${stringifyRequest(include)};`)
|
...post.map((include: any) => `import ${stringifyRequest(include)};`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue