Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
rollup-plugin-monaco-editor
Advanced tools
A rollup plugin to import monaco editor
0.21.2
NOTE: different version of monaco-editor
has different feature definitions. This plugin just tests with 0.21.2
version for now.
This plugin should be used with other plugins. including
@rollup/plugin-node-resolve
rollup-plugin-postcss
(or other plugin can handle .css
files)@rollup/plugin-commonjs
// rollup.config.js
import resolve from '@rollup/plugin-node-resolve';
import postcss from 'rollup-plugin-postcss';
import commonjs from '@rollup/plugin-commonjs';
import monaco from 'rollup-plugin-monaco-editor';
export default {
// ...other config
plugins: [
// ...other plugins
// handle .css files
postcss(),
monaco({
esm: true, // true if you set output.format is esm
pathPrefix: 'dist', // mostly same as output.dir
languages: ['json'],
}),
resolve({
mainFields: [
'exports',
'browser:module',
'browser',
'module',
'main',
].filter(Boolean),
extensions: ['.mjs', '.cjs', '.js', '.json'], // Default: [ '.mjs', '.js', '.json', '.node' ]
// whether to prefer built-in modules (e.g. `fs`, `path`) or local ones with the same names
preferBuiltins: true, // Default: true
dedupe: [], // userDefinedRollup.dedupe,
}),
commonjs(),
],
};
yarn install
yarn build
yarn build:example
yarn start:example
visit http://localhost:8080
to see the simple demo.
yarn start
This is a tricky issue, languages need monaco
API to register language. For now languages are imported via dynamic import, this leads to the issue if you create
the monaco editor after importing the monaco module immediately. It might be fixed after the chrome supports top-level await, but i can't find a good solution right now.
MIT
FAQs
> A rollup plugin to import monaco editor
The npm package rollup-plugin-monaco-editor receives a total of 90 weekly downloads. As such, rollup-plugin-monaco-editor popularity was classified as not popular.
We found that rollup-plugin-monaco-editor 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.