clipboardyはvscodeからは使えないので没
なんか急にデバッグ実行できなくなったんだが
code:a
Activating extension 'stakiran.vscode-scb-commands' failed: require() of ES Module
commandもnot foundになる
Activating extension 'stakiran.vscode-scb-commands' failed: require() of ES Module /Users/.../language-feature/node_modules/clipboardy/index.js from /Users/.../language-feature/out/extension.js not supported. Instead change the require of index.js in /Users/.../language-feature/out/extension.js to a dynamic import() which is available in all CommonJS modules..
requireはサポートされてない
かわりにdynamic import()を使え?
何言ってるかわからんsta.icon
なんかダウングレードしろってさ
npm i node-fetch@2.6.1
が、node-fetchなんて依存してないので違う
---
書き方おかしい?
https://gyazo.com/519e8d1b8a1ed13056342494f7dc13e0
5行目以外は(内部的に)require方式になってるってこと?sta.icon
type module入れてみたけど
code:err
Activating extension 'stakiran.vscode-scb-commands' failed: require() of ES Module /Users/.../language-feature/out/extension.js from /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js not supported. extension.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules. Instead rename extension.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/.../language-feature/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead). .
NodeまわりのCommonJSとES Moduleのimportの違い
nodeではrequire()方式
が、フロントエンド側に合わせてimport方式にシフトしていっている
なんか{}でimportすればいい?
https://gyazo.com/b2f4507c4561f1795d2dce6f4d6b9070
ダメだけど?
https://gyazo.com/b269886a4474a173bda3e846536c4329
Module '"clipboardy"' has no exported member 'writeSync'. Did you mean to use 'import writeSync from "clipboardy"' instead?
呼べないけど?
https://gyazo.com/08f0092cec508a418142fc59db72e8d8
https://gyazo.com/deef745a3fdb7b1b76f46dde04b49eba
This expression is not callable.
Type '{ write(text: string): Promise<void>; read(): Promise<string>; writeSync(text: string): void; readSync(): string; }' has no call signatures.
たぶんclipboardyモジュールのつくりが対応してないっぽいなsta.icon
dynamic import
こんなわけわからんのやってらるかよsta.icon