-
-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue with v6.5.0 (There is already an extension with this id error) on inputFactories #546
Comments
Had the same problem with vite cdietrich/my-monaco-editor-react-example@7f597fb |
@OliverwengFiltered and @cdietrich thanks for reporting. We should add that this to our troubleshooting section. |
This problem is also happening in Nextjs, I'm not sure if Next has a dedupe feature yet |
I'm not sure it's required. it's required in the monaco-vscode-api demo because there is a local dependency I think this is just a duplicated dependency issue here |
@kaisalmen , the troubleshooting link only mention a recommendation for Vite. Anything recommendation for Webpack ? |
@CGNonofr is probably right. When I remove the dedupe instruction here, it just works, because dependencies are clear (=no mismatching versions) @OliverwengFiltered the webpack verification example works also fine: I will clarify the README. |
Done ✅ |
wonder where the mismatching versions came from when i just had a dependency to monaco-editor-react but i can see this locally:
|
|
I was able to make version 5.0.1 work with Nextjs using this webpack config // next.config.js
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const { patchWebpackConfig } = require('next-global-css');
/** @type {import('next').NextConfig} */
let nextConfig = {
swcMinify: true,
experimental: {
forceSwcTransforms: true,
},
transpilePackages: ['monaco-languageclient'],
webpack(config, options) {
// this fixes some issues with loading web workers
config.output.publicPath = '/_next/';
// because next.js doesn't like node_modules that import css files
// this solves the issue for monaco-editor, which relies on importing css files
patchWebpackConfig(config, options);
// alias the inlined, vscode forked marked
// implementation to the actual library
config.resolve.alias['../common/marked/marked.js'] = 'marked';
// adding monaco-editor to your bundle is slow as is,
// no need to bundle it for the server in addition to the client
if (!options.isServer) {
config.plugins.push(
// if you find yourself needing to override
// MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker,
// you probably just need to tweak configuration here.
new MonacoWebpackPlugin({
// you can add other languages here as needed
languages: [
'json',
'css',
'javascript',
'typescript',
'java',
'python',
'csharp',
],
filename: 'static/[name].worker.js',
})
);
// load monaco-editor provided ttf fonts
config.module.rules.push({ test: /\.ttf$/, type: 'asset/resource' });
}
return config;
},
};
module.exports = nextConfig; whenever I even import |
@OliverwengFiltered @cdietrich @rajialtooro and @CGNonofr it because of the missing "dependencies": {
"monaco-editor": "~0.43.0",
"vscode": "npm:@codingame/monaco-vscode-api@1.82.2",
"@codingame/monaco-vscode-languages-service-override": "~1.82.2",
"@codingame/monaco-vscode-model-service-override": "~1.82.2",
"vscode-jsonrpc": "~8.1.0",
"vscode-languageclient": "~8.1.0"
}, As far as I know the |
@kaisalmen "vscode": "npm:@codingame/monaco-vscode-api@>=1.82.0 <1.83.0" |
@rajialtooro that seems to work indeed: |
@kaisalmen so assuming it will need a release on the monaco-languageclient side to fix the version mismatch here? |
Yes, exactly |
New release is available: Thank you all for getting to the bottom of this fairly quickly! |
@kaisalmen , the latest version solves the mismatch error mentioned above, however, after bundling and building with the latest version 6.5.1, the editor just doesn't show up in DOM (blank), it's just does not render, and there is no console error printed as well, I wonder if you can reproduce it on your end. and then I rolled back to v 6.4.6, the old version 6.4.6 works fine. |
@OliverwengFiltered just checked the examples again incl. webpack verification and also with |
@OliverwengFiltered I'm facing the same issue with Nextjs, when I import anything from when I tried to load it asynchronously like this // in editor.tsx
import('./lsp').then(t =>
t.performInit().catch(err => {
console.log(err);
})
);
...
// lsp.ts
import { initServices } from 'monaco-languageclient';
export const performInit = async () => {
await initServices({ userServices: {}, debugLogging: true });
}; |
@rajialtooro when i saw something like this in the past the problem was a bad polyfill for buffer. can you double check which version your use? |
@cdietrich these are the related packages I have, keep in mind that with the same config version 5.0.1 was working "monaco-editor": "^0.43.0",
"monaco-editor-webpack-plugin": "^7.1.0",
"monaco-languageclient": "^6.5.1",
"next": "^13.2.4",
"vscode-ws-jsonrpc": "^3.0.0", |
@rajialtooro the question is what else may pull "buffer" and if yes in which version. if no buffer is pulled then the problem is something else |
@cdietrich I ran |
i had to resolve buffer to a newer version in package.json
the vscode buffer checks if buffer is available in global and if yes uses that one |
@cdietrich Worked like a charm, thank you 🥳 |
@kaisalmen might this be something for the troubleshooting section? this is including mine the 3rd occurrance of this problem? (see also #538) |
@cdietrich good suggestion, see here |
thx for the quick fixes @kaisalmen |
I have this error (Assertion failed (There is already an extension with this id)) also in 7.3.0 (react.js, webpack) whenI tempororay commented out MonacoWebpackPlugin is there any workaround to fix this errors? |
You can still use @kaisalmen maybe we should go back to monaco-editor-core as we don't use any of the features added by monaco-editor on top of the core |
@CGNonofr thanks for quick answer. But I don't know, what feature I need to disable? this is my imports
|
@CGNonofr thanks it helps to webpack problem but I still have |
if you want some help, please provide a minimal repo |
It seems that this is minimal repo ...
without |
What bundler do you use? with what configuration? what versions of the libs do you use? did you try what was discussed previously about buffer? are you sure there is no duplicated versions of some libs? |
@CGNonofr Isn't this default what |
@codingame/monaco-editor-treemended is a patched version that, among other things, removes everything added by monaco-editor. Using monaco-editor instead if monaco-editor-core makes the patch file a lot bigger and doesn't really make sense anymore. Also monaco-editor is bundled with metadata files used by the monaco-webpack-loader and those files are untouched in monaco-editor-treemended, leading to confusing errors for users |
@CGNonofr Ok, so whatever we have it is not compatible with regular This way people realize the have something else and could force it in the dependency chain instead of monaco-editor. Also, then people no longer need such tooling (MonacoWebpackPlugin), right? Does it make sense? WDYT? |
let's discuss it on CodinGame/monaco-vscode-api#325 |
Good idea. I need to do something else right now. Proper feedback will come tonight or tomorrow |
After upgrading to the latest version, it builds successfully, but throws error on the run time. The console says (There is already an extension with this id error) on inputFactories.
it looks like the
inputFactories
got imported twice ?appreciate any insights.
@kaisalmen
@CGNonofr
The text was updated successfully, but these errors were encountered: