Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
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
2.1.0
2022-04-21
nls.js
now in monaco-editor
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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.