Closed danielweck closed 3 years ago
You need to make sure to use twind >=0.16.0.
Yes, I use all the latest versions of everything :)
Just to be sure:
Finally, run the Select TypeScript version
command in VS Code to switch to use the workspace version of TypeScript for VS Code's JavaScript and TypeScript language support. You can find more information about managing typescript versions in the VS Code documentation.
Yep, I always check this as well (my day job involves a ton of TypeScript + VSCode)
Got it! (I think)
TypeError: typography_default is not a function
TSS_LOG="-logToFile true -file ./tss.log -level verbose" code . && code tss.log
TypeError: typography_default is not a function
at eval (eval at loadConfig (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:189:3), <anonymous>:3128:6)
at loadConfig (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:189:102)
at getConfig (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:202:21)
at Twind.get state [as state] (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:483:37)
at Twind._getCompletions (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:537:12)
at Twind.get completions [as completions] (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:534:59)
at TwindTemplateLanguageService.getCompletionTokens (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:1069:12)
at TwindTemplateLanguageService.getCompletionsAtPosition (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:934:30)
at Proxy.<anonymous> (/PATH/TO/node_modules/typescript-template-language-service-decorator/lib/template-language-service-decorator.js:86:85)
at /Users/danielweck/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.12/node_modules/@vsintellicode/typescript-intellicode-plugin/lib/index.js:2:3222
at Object.l.getCompletionsAtPosition (/Users/danielweck/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.12/node_modules/@vsintellicode/typescript-intellicode-plugin/lib/index.js:2:8139)
at IOSession.Session.getCompletions (/PATH/TO/node_modules/typescript/lib/tsserver.js:160329:64)
at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/PATH/TO/node_modules/typescript/lib/tsserver.js:159208:61)
at /PATH/TO/node_modules/typescript/lib/tsserver.js:160963:88
at IOSession.Session.executeWithRequestId (/PATH/TO/node_modules/typescript/lib/tsserver.js:160954:28)
at IOSession.Session.executeCommand (/PATH/TO/node_modules/typescript/lib/tsserver.js:160963:33)
at IOSession.Session.onMessage (/PATH/TO/node_modules/typescript/lib/tsserver.js:160989:35)
at Interface.<anonymous> (/PATH/TO/node_modules/typescript/lib/tsserver.js:163650:31)
at Interface.emit (events.js:315:20)
at Interface._onLine (readline.js:329:10)
at Interface._normalWrite (readline.js:474:12)
at Socket.ondata (readline.js:186:10)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:186:23)
TypeError: typography_default is not a function
at eval (eval at loadConfig (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:189:3), <anonymous>:3128:6)
at loadConfig (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:189:102)
at getConfig (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:202:21)
at Twind.get state [as state] (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:483:37)
at Twind.getDiagnostics (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:525:12)
at /PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:1013:63
at Array.flatMap (<anonymous>)
at TwindTemplateLanguageService.getSemanticDiagnostics (/PATH/TO/node_modules/@twind/typescript-plugin/typescript-plugin.cjs:1013:32)
at TemplateLanguageServiceProxy.adaptDiagnosticsCall (/PATH/TO/node_modules/typescript-template-language-service-decorator/lib/template-language-service-decorator.js:256:38)
at Proxy.<anonymous> (/PATH/TO/node_modules/typescript-template-language-service-decorator/lib/template-language-service-decorator.js:53:25)
at IOSession.Session.semanticCheck (/PATH/TO/node_modules/typescript/lib/tsserver.js:159664:52)
at /PATH/TO/node_modules/typescript/lib/tsserver.js:159720:31
at MultistepOperation.executeAction (/PATH/TO/node_modules/typescript/lib/tsserver.js:158670:25)
at /PATH/TO/node_modules/typescript/lib/tsserver.js:158649:100
at IOSession.Session.executeWithRequestId (/PATH/TO/node_modules/typescript/lib/tsserver.js:160954:28)
at Object.executeWithRequestId (/PATH/TO/node_modules/typescript/lib/tsserver.js:159432:87)
at Immediate._onImmediate (/PATH/TO/node_modules/typescript/lib/tsserver.js:158649:41)
at processImmediate (internal/timers.js:456:21)
I tried twind.config.mjs
with both:
import * as typography from '@twind/typography';
...
plugins: {
...typography.default(),
},
and
import typography from '@twind/typography';
...
plugins: {
...typography(),
},
Note that the Typography plugin works fine in my web app. It is only the plugin that fails to load the config.
Note that adding "type": "module"
to my package.json
doesn't help.
...in fact this breaks my Preact WMR prerender static SSR build with the following error:
Error: [LATE_SETUP_CALL] {}
at file:///PATH/TO/dist/chunks/prerender.8023479f.js:125:1
at ModuleJob.run (internal/modules/esm/module_job.js:152:23)
at async Loader.import (internal/modules/esm/loader.js:166:24)
at async prerender (file:///PATH/TO/dist/index.04c0e754.js:1109:33)
at async hVe ([worker eval]:1:1381)
Interestingly, adding "type": "module"
to my package.json
also breaks the Twind forms and typography plugins (no obvious stack trace in my Preact WMR development server console)
Great! I know how to fix that!
Thanks for the analysis. Found the issue and should be fixed in 0.2.3. I added the typography in my test repo.
Regarding the "type": "module"
issue: I may have time on the weekend to look into that.
Great, so nice to have auto-completion back! :) Thank you.
Regarding the
"type": "module"
issue: I may have time on the weekend to look into that.
Please ignore this, false alert. The error messages did show up in my console, and the web browser was not showing the styles exported by the Twind pluginsv ... but after rm -rf node_modules && rm package-lock.json && npm install
(which I do regularly, after ncu
"NPM Check Updates" and npm update --save --save-dev
) ... everything worked fine again!! (I just had to rename .js
configuration files for ESLint and Prettier to .cjs
) I am on Node v14.16.0
, NPM v6.14.11
at the moment.
Damn, I swear this was working before, but since a few days ago the plugin seems dead (no autocompletion, nothing). I have no idea what the breaking change is.
I tried all versions from: https://www.npmjs.com/package/@twind/typescript-plugin ...the only one that works is the old
0.1.0
.Naturally, I have all my NPM packages up to date, and VSCode too with the latest TypeScript.
Any idea? What VSCode / TypeScript etc. versions to you test with?
PS: my VSCode config: