Skip to content

Commit 7a74b27

Browse files
author
Loïc Mangeonjean
committed
fix: transform monaco import from monaco-emacs/vim to be esm strict compliant
1 parent 8e01bf3 commit 7a74b27

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

rollup.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import vsixPlugin from '@codingame/monaco-vscode-rollup-vsix-plugin'
99
import glob from 'fast-glob'
1010
import path from 'path'
1111
import pkg from './package.json' assert { type: 'json' }
12+
import { addExtension } from '@rollup/pluginutils'
1213

1314
const externals = Object.keys(pkg.dependencies)
1415

@@ -43,6 +44,20 @@ export default rollup.defineConfig({
4344
{
4445
name: 'external-resolver',
4546
resolveId (id) {
47+
// monaco-editor can safely be imported with monaco-vscode-api
48+
if (id === 'monaco-editor/esm/vs/editor/editor.api') {
49+
return {
50+
id: 'monaco-editor',
51+
external: 'absolute'
52+
}
53+
}
54+
// Add missing .js extension to respect ESM strict mode
55+
if (id.startsWith('monaco-editor/esm')) {
56+
return {
57+
id: addExtension(id, '.js'),
58+
external: 'absolute'
59+
}
60+
}
4661
if (/\.wasm$/.test(id) || externals.some(external => id === external || id.startsWith(`${external}/`))) {
4762
return {
4863
id,

0 commit comments

Comments
 (0)