mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 07:00:11 +01:00
Rename to /samples/
This commit is contained in:
parent
c9081ee4f3
commit
091f871e65
85 changed files with 12 additions and 15 deletions
2
samples/browser-esm-webpack/.gitignore
vendored
Normal file
2
samples/browser-esm-webpack/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
dist/*.js
|
||||
dist/*.ttf
|
||||
11
samples/browser-esm-webpack/dist/index.html
vendored
Normal file
11
samples/browser-esm-webpack/dist/index.html
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="container" style="width: 800px; height: 600px; border: 1px solid #ccc"></div>
|
||||
|
||||
<script src="./app.bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
20
samples/browser-esm-webpack/index.html
Normal file
20
samples/browser-esm-webpack/index.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h2>Monaco Editor Webpack Sample</h2>
|
||||
|
||||
To run this sample, you need to:
|
||||
|
||||
<pre>
|
||||
$/> npm install .
|
||||
$/> npm run simpleserver
|
||||
$/browser-esm-webpack> npm run build
|
||||
</pre
|
||||
>
|
||||
|
||||
Then, <a href="./dist">open the ./dist folder</a>.
|
||||
</body>
|
||||
</html>
|
||||
24
samples/browser-esm-webpack/index.js
Normal file
24
samples/browser-esm-webpack/index.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import * as monaco from 'monaco-editor';
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorkerUrl: function (moduleId, label) {
|
||||
if (label === 'json') {
|
||||
return './json.worker.bundle.js';
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
return './css.worker.bundle.js';
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
return './html.worker.bundle.js';
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
return './ts.worker.bundle.js';
|
||||
}
|
||||
return './editor.worker.bundle.js';
|
||||
}
|
||||
};
|
||||
|
||||
monaco.editor.create(document.getElementById('container'), {
|
||||
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
|
||||
language: 'javascript'
|
||||
});
|
||||
6
samples/browser-esm-webpack/package.json
Normal file
6
samples/browser-esm-webpack/package.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "browser-esm-webpack",
|
||||
"scripts": {
|
||||
"build": "node ../node_modules/webpack/bin/webpack.js --progress"
|
||||
}
|
||||
}
|
||||
30
samples/browser-esm-webpack/webpack.config.js
Normal file
30
samples/browser-esm-webpack/webpack.config.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: {
|
||||
app: './index.js',
|
||||
'editor.worker': 'monaco-editor/esm/vs/editor/editor.worker.js',
|
||||
'json.worker': 'monaco-editor/esm/vs/language/json/json.worker',
|
||||
'css.worker': 'monaco-editor/esm/vs/language/css/css.worker',
|
||||
'html.worker': 'monaco-editor/esm/vs/language/html/html.worker',
|
||||
'ts.worker': 'monaco-editor/esm/vs/language/typescript/ts.worker'
|
||||
},
|
||||
output: {
|
||||
globalObject: 'self',
|
||||
filename: '[name].bundle.js',
|
||||
path: path.resolve(__dirname, 'dist')
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue