-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix: monaco-graphql
exports, validate on load
#3384
Conversation
🦋 Changeset detectedLatest commit: 1c815c9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -19,4 +19,14 @@ | |||
import 'monaco-editor/esm/vs/basic-languages/graphql/graphql.contribution.js'; | |||
import 'monaco-editor/esm/vs/language/json/monaco.contribution.js'; | |||
|
|||
export * from 'monaco-editor/esm/vs/editor/edcore.main.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edcore.main.js
imports editor.all.js
, which includes many features we don't even use yet!
instead, we implement only the minimum features we need for our mode to work, and users can opt in to the rest
@@ -13,7 +13,7 @@ describe('monaco-editor', () => { | |||
// expect(lines[0]).toBe('$ vite build'); | |||
// expect(lines[1]).toMatch(' building for production...'); | |||
// expect(lines[2]).toBe('transforming...'); | |||
expect(lines[3]).toMatch('✓ 970 modules transformed.'); | |||
expect(lines[3]).toMatch('✓ 839 modules transformed.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reduces the total modules by replacing edcore.main.js
, even though we add the typescript mode to the vite bundle!
✅ Deploy Preview for graphiql-test ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
0d6b286
to
38782da
Compare
38782da
to
1ac8b46
Compare
The latest changes of this PR are available as canary in npm (based on the declared |
e076ca8
to
1ac8b46
Compare
295cdcd
to
4adf2b4
Compare
@bboure feel free to give the canary release here a try! |
Here are some issues I found:
Same error with
I think all these errors are related to the With the following config in my project: import * as monaco from 'monaco-editor'; // force fully featured monaco
import { initializeMode } from 'monaco-graphql/initializeMode';
initializeMode(); new MonacoWebpackPlugin({
languages: ['json', 'typescript', 'graphql'],
features: ['!readOnlyMessage'],
customLanguages: [
{
entry: undefined,
label: 'graphql',
worker: {
id: 'graphql',
entry: require.resolve('monaco-graphql/esm/graphql.worker.js'),
},
},
],
}), Graphql features don't work: autocomplete, validation, formatting... Speaking of typescript, at some point, I also faced that issue that I never had before. These are just a few issues I met. I'll try to do more tests and investigate what causes them later this weekend. And thanks for the great work! |
there is no /full export if that helps! strange though, so many of these are working for me with vite and webpack |
@bboure specifying the typescript language to the webpack plugin will break your project, because of a bug with thier webpack plugin. see comments in the webpack config in this PR to learn how to get typescript working. enjoy! |
@acao I did see the typescript fix, thanks. and it worked. I was just saying that it used to work for me before. Another thing I noticed, but minor. The canary release does not include the updates in FYI, The README shows an example importing full |
@bboure i fixed the readme and added some |
@B2o5T this is important as it includes several key bugfixes, and is a useful preceeding step to |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3384 +/- ##
==========================================
+ Coverage 55.75% 55.85% +0.10%
==========================================
Files 110 110
Lines 5243 5256 +13
Branches 1426 1432 +6
==========================================
+ Hits 2923 2936 +13
Misses 1897 1897
Partials 423 423
|
typescript
language mode & workerexports
aliases that are backwards compatible, but allowmonaco-graphql/initializeMode
andmonaco-graphql/graphql.worker
to be imported directlymonaco-graphql/lite
import for minimal features