UNPKG

2.05 kBTypeScriptView Raw
1import type * as webpack from 'webpack';
2import { EditorLanguage } from './languages';
3import { EditorFeature, NegatedEditorFeature } from './features';
4import { IFeatureDefinition } from './types';
5interface IMonacoEditorWebpackPluginOpts {
6 /**
7 * Include only a subset of the languages supported.
8 */
9 languages?: EditorLanguage[];
10 /**
11 * Custom languages (outside of the ones shipped with the `monaco-editor`).
12 */
13 customLanguages?: IFeatureDefinition[];
14 /**
15 * Include only a subset of the editor features.
16 * Use e.g. '!contextmenu' to exclude a certain feature.
17 */
18 features?: (EditorFeature | NegatedEditorFeature)[];
19 /**
20 * Specify a filename template to use for generated files.
21 * Use e.g. '[name].worker.[contenthash].js' to include content-based hashes.
22 */
23 filename?: string;
24 /**
25 * Override the public path from which files generated by this plugin will be served.
26 * This wins out over Webpack's dynamic runtime path and can be useful to avoid attempting to load workers cross-
27 * origin when using a CDN for other static resources.
28 * Use e.g. '/' if you want to load your resources from the current origin.
29 */
30 publicPath?: string;
31 /**
32 * Specify whether the editor API should be exposed through a global `monaco` object or not. This
33 * option is applicable to `0.22.0` and newer version of `monaco-editor`. Since `0.22.0`, the ESM
34 * version of the monaco editor does no longer define a global `monaco` object unless
35 * `global.MonacoEnvironment = { globalAPI: true }` is set ([change
36 * log](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md#0220-29012021)).
37 */
38 globalAPI?: boolean;
39}
40declare class MonacoEditorWebpackPlugin implements webpack.WebpackPluginInstance {
41 private readonly options;
42 constructor(options?: IMonacoEditorWebpackPluginOpts);
43 apply(compiler: webpack.Compiler): void;
44}
45export = MonacoEditorWebpackPlugin;