Comments (4)
Can you try to add the following to the compiler options:
moduleResolution: options.monaco.languages.typescript.ModuleResolutionKind.NodeJs,
allowSyntheticDefaultImports: true,
rootDir: options.fileRootPath,
and if you're not already doing that, maybe also try importing AutoTypings from monaco-editor-auto-typings/custom-editor
rather from monaco-editor-auto-typings
directly.
from monaco-editor-auto-typings.
Hello @dolanmiu, thank you for your report. Can you share the code you put into monaco, and the code that you used to mount monaco and attach the auto-typings plugin?
from monaco-editor-auto-typings.
Very simple, but I pass my own version of monaco
const model = monaco.editor.createModel('', 'typescript', monaco.Uri.parse('inmemory://model/widget.tsx'));
model.updateOptions({ tabSize: 2 });
this.editor = monaco.editor.create(this.editorContainer.nativeElement, {
model,
language: 'typescript',
theme: 'vs-dark',
automaticLayout: true,
});
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
...monaco.languages.typescript.typescriptDefaults.getCompilerOptions(),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
jsx: 'react' as any,
lib: ['dom', 'esnext'],
});
this.autoTypings = await AutoTypings.create(this.editor, {
monaco,
sourceCache: storage, // Cache loaded sources in localStorage. May be omitted
onUpdate: (u, t) => {
if (u.type === 'StoredToCache' || u.type === 'LoadedFromCache') {
for (const origin of CONSUMER_SPA_ORIGINS) {
this.window.postMessage([t], origin);
}
}
},
onError: (e) => {
for (const origin of CONSUMER_SPA_ORIGINS) {
this.window.postMessage([e], origin);
}
},
});
from monaco-editor-auto-typings.
Can you try to add the following to the compiler options:
moduleResolution: options.monaco.languages.typescript.ModuleResolutionKind.NodeJs, allowSyntheticDefaultImports: true, rootDir: options.fileRootPath,
and if you're not already doing that, maybe also try importing AutoTypings from
monaco-editor-auto-typings/custom-editor
rather frommonaco-editor-auto-typings
directly.
applying these steps fixed it for me, without specifying rootDir
as I'm not sure where its value would come from.
from monaco-editor-auto-typings.
Related Issues (20)
- QuotaExceededError: Failed to execute 'setItem' on 'Storage': Setting the value of 'PACKAGE' exceeded the quota. HOT 1
- [BUG] Custom version is not downloaded - latest is downloaded instead HOT 1
- [BUG] Not able to load types to .js files imports
- [FEEDBACK] Reload all packages after setVersions HOT 2
- [BUG] not working for "react-dom/client"
- [REQUEST] build the file + the imported package HOT 1
- [BUG] TypeError: path.dirname is not a function HOT 10
- [REQUEST] Provide types for JavaScript (non-TypeScript) documents HOT 3
- [BUG] Document the `monaco` option
- [BUG] Cannot find module 'moment' or its corresponding type declarations.(2307)
- [BUG] Not all Node Types are imported
- [BUG] Official demo doesn't work for react HOT 2
- [BUG] Packages for the web do not work with auto typings HOT 1
- [BUG] Unable to load @types/lodash reference command not recognized successfully
- [BUG] Does not work with zod types
- [BUG] Does not work with packages which do not specify `types` or `typings`
- [REQUEST] Use WebContainer to run node in the browser to fetch files
- [BUG] TypeError: path.dirname is not a function HOT 1
- [BUG] Demo website broken?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monaco-editor-auto-typings.