Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
monaco-editor-esm-webpack-plugin
Advanced tools
The webpack's plugin for monaco editor to compile the worker and handle with localization
It dependency on monaco-editor-webpack-plugin.
If you want copy a monaco editor with localization, you can see primefaces-monaco
The webpack's plugin for monaco editor to compile the worker and handle with localization.
npm install monaco-editor-esm-webpack-plugin --save-dev
npm install monaco-editor monaco-editor-webpack-plugin monaco-editor-nls
webpack.config.js
const MonacoWebpackPlugin = require('monaco-editor-esm-webpack-plugin');
module.exports = {
entry: './index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'app.js'
},
module: {
rules: [
{
test: /\.js/,
enforce: 'pre',
include: /node_modules[\\\/]monaco-editor[\\\/]esm/,
use: MonacoWebpackPlugin.loader
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
plugins: [
new MonacoWebpackPlugin()
]
};
Set the locale data in your code
// index.js
import { setLocaleData } from 'monaco-editor-nls';
import zh_CN from 'monaco-editor-nls/locale/zh-hans';
setLocaleData(zh_CN);
// You must import/require after `setLocaleData`
// Do not use `import * as monaco from 'XXX'`, but can use `import('xxx').then(XXX)`
const monaco = require('monaco-editor/esm/vs/editor/editor.api');
monaco.editor.create(document.getElementById('root'), { language: 'javascript' });
There only two options for this plugin. But you can set the monaco-editor-webpack-plugin's options in this options. such as: new MonacoWebpackPlugin({ languages: ['typescript'] })
isMonacoEditorWebapckPlugin - whether monaco-editor-webpack-plugin is used. Default: true
isReplaceNls - whether replace the nls file. Default: true
Why the project can't start after add the plugin with monaco-editor
and monaco-editor-webpack-plugin
?
The version of monaco-editor
should match with monaco-editor-webpack-plugin
, you can see: https://github.com/microsoft/monaco-editor-webpack-plugin/#version-matrix
FAQs
The webpack's plugin for monaco editor to compile the worker and handle with localization
The npm package monaco-editor-esm-webpack-plugin receives a total of 91 weekly downloads. As such, monaco-editor-esm-webpack-plugin popularity was classified as not popular.
We found that monaco-editor-esm-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.