mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 13:55:41 +01:00
Add esbuild sample
This commit is contained in:
parent
3638651cde
commit
7318711606
6 changed files with 108 additions and 0 deletions
45
samples/browser-esm-esbuild/build.js
Normal file
45
samples/browser-esm-esbuild/build.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
const esbuild = require('esbuild');
|
||||
const path = require('path');
|
||||
const { removeDir } = require('../../build/utils');
|
||||
|
||||
removeDir(path.join(__dirname, 'dist'));
|
||||
|
||||
const workerEntryPoints = [
|
||||
'vs/language/json/json.worker.js',
|
||||
'vs/language/css/css.worker.js',
|
||||
'vs/language/html/html.worker.js',
|
||||
'vs/language/typescript/ts.worker.js',
|
||||
'vs/editor/editor.worker.js'
|
||||
];
|
||||
|
||||
build({
|
||||
entryPoints: workerEntryPoints.map((entry) => `../node_modules/monaco-editor/esm/${entry}`),
|
||||
bundle: true,
|
||||
format: 'iife',
|
||||
outbase: '../node_modules/monaco-editor/esm/',
|
||||
outdir: path.join(__dirname, 'dist')
|
||||
});
|
||||
|
||||
build({
|
||||
entryPoints: ['index.js'],
|
||||
bundle: true,
|
||||
format: 'iife',
|
||||
outdir: path.join(__dirname, 'dist'),
|
||||
loader: {
|
||||
'.ttf': 'file'
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {import ('esbuild').BuildOptions} opts
|
||||
*/
|
||||
function build(opts) {
|
||||
esbuild.build(opts).then((result) => {
|
||||
if (result.errors.length > 0) {
|
||||
console.error(result.errors);
|
||||
}
|
||||
if (result.warnings.length > 0) {
|
||||
console.error(result.warnings);
|
||||
}
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue