mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 08:10: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-monaco-plugin/.gitignore
vendored
Normal file
2
samples/browser-esm-webpack-monaco-plugin/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
dist/*.js
|
||||
dist/*.ttf
|
||||
9
samples/browser-esm-webpack-monaco-plugin/dist/index.html
vendored
Normal file
9
samples/browser-esm-webpack-monaco-plugin/dist/index.html
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<script src="./main.bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
20
samples/browser-esm-webpack-monaco-plugin/index.html
Normal file
20
samples/browser-esm-webpack-monaco-plugin/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 Plugin Sample</h2>
|
||||
|
||||
To run this sample, you need to:
|
||||
|
||||
<pre>
|
||||
$/> npm install .
|
||||
$/> npm run simpleserver
|
||||
$/browser-esm-webpack-monaco-plugin> npm run build
|
||||
</pre
|
||||
>
|
||||
|
||||
Then, <a href="./dist">open the ./dist folder</a>.
|
||||
</body>
|
||||
</html>
|
||||
16
samples/browser-esm-webpack-monaco-plugin/index.js
Normal file
16
samples/browser-esm-webpack-monaco-plugin/index.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
|
||||
(function () {
|
||||
// create div to avoid needing a HtmlWebpackPlugin template
|
||||
const div = document.createElement('div');
|
||||
div.id = 'root';
|
||||
div.style = 'width:800px; height:600px; border:1px solid #ccc;';
|
||||
|
||||
document.body.appendChild(div);
|
||||
})();
|
||||
|
||||
monaco.editor.create(document.getElementById('root'), {
|
||||
value: `const foo = () => 0;`,
|
||||
language: 'javascript',
|
||||
theme: 'vs-dark'
|
||||
});
|
||||
6
samples/browser-esm-webpack-monaco-plugin/package.json
Normal file
6
samples/browser-esm-webpack-monaco-plugin/package.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "browser-esm-webpack-monaco-plugin",
|
||||
"scripts": {
|
||||
"build": "node ../node_modules/webpack/bin/webpack.js --progress"
|
||||
}
|
||||
}
|
||||
28
samples/browser-esm-webpack-monaco-plugin/webpack.config.js
Normal file
28
samples/browser-esm-webpack-monaco-plugin/webpack.config.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
const path = require('path');
|
||||
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: process.env.NODE_ENV,
|
||||
entry: './index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: '[name].bundle.js'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new MonacoWebpackPlugin({
|
||||
languages: ['typescript', 'javascript', 'css']
|
||||
})
|
||||
]
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue