Adopt loader-utils breaking changes

This commit is contained in:
Alex Dima 2021-11-16 09:41:37 +01:00
parent ed1ee25b7b
commit 009bc9b864
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
2 changed files with 26 additions and 12 deletions

View file

@ -6,6 +6,7 @@ import { AddWorkerEntryPointPlugin } from './plugins/AddWorkerEntryPointPlugin';
import { languagesArr, EditorLanguage } from './languages';
import { featuresArr, EditorFeature, NegatedEditorFeature } from './features';
import { IFeatureDefinition } from './types';
import { ILoaderOptions } from './loaders/include';
const INCLUDE_LOADER_PATH = require.resolve('./loaders/include');
@ -282,17 +283,18 @@ function createLoaderRules(
};
})(${JSON.stringify(workerPaths, null, 2)})`
};
const options: ILoaderOptions = {
globals,
pre: featurePaths.map((importPath) => resolveMonacoPath(importPath, monacoEditorPath)),
post: languagePaths.map((importPath) => resolveMonacoPath(importPath, monacoEditorPath))
};
return [
{
test: /esm[/\\]vs[/\\]editor[/\\]editor.(api|main).js/,
use: [
{
loader: INCLUDE_LOADER_PATH,
options: {
globals,
pre: featurePaths.map((importPath) => resolveMonacoPath(importPath, monacoEditorPath)),
post: languagePaths.map((importPath) => resolveMonacoPath(importPath, monacoEditorPath))
}
options
}
]
}