Skip to content
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 editor types resolution #1342

Merged
merged 5 commits into from
Feb 27, 2024
Merged

Conversation

KermanX
Copy link
Member

@KermanX KermanX commented Feb 27, 2024

This PR fixes:

  • omit duplicate dependencies

  • declaration files searching

@@ -43,19 +43,20 @@ export function createMonacoTypesLoader({ userRoot }: ResolvedSlidevOptions): Pl
].join('\n')
}

const matchLoad = id.match(/^\/\@slidev-monaco-types\/load(\/.*?)&name=(.*)$/)
const matchLoad = id.match(/^\/\@slidev-monaco-types\/load\/(.*?)&name=(.*)$/)
Copy link
Member Author

@KermanX KermanX Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very sure about this change. (Reverting a85ac6a)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some resolution add leading slash some are not, you will see paths like:

/@slidev-monaco-types/load//Users/xx... and
/@slidev-monaco-types/load/Users/xx...

We should probably unify them on generation. We just need to make sure the root passed to fg is absolute.

(and this might have some issues on Windows? 👀)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is broken on Windows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed the URL format to

  • /@slidev-monaco-types/resolve?pkg=...&importer=...
  • /@slidev-monaco-types/load?root=...&name=...

Also, raw imports are now like ...?monaco-types&raw, so that manualChunk can work correctly.

@KermanX KermanX marked this pull request as draft February 27, 2024 09:34
@KermanX KermanX marked this pull request as ready for review February 27, 2024 09:49
@antfu antfu changed the title fix: monaco editor fix: monaco editor types resolution Feb 27, 2024
@antfu antfu merged commit af6e9b4 into slidevjs:main Feb 27, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants