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

A dynamic import callback was not specified #14917

Closed
jmatsushita opened this issue Jun 10, 2023 · 3 comments
Closed

A dynamic import callback was not specified #14917

jmatsushita opened this issue Jun 10, 2023 · 3 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. scope:external This is not an issue with Prettier, it’s an issue with external software, like an editor integration

Comments

@jmatsushita
Copy link

jmatsushita commented Jun 10, 2023

Getting this error when using prettier from the prettier-vscode extension. The error is also reported here prettier/prettier-vscode#3007 but seems to originate from prettier:

["ERROR" - 13:22:40] Error handling text editor change
["ERROR" - 13:22:40] A dynamic import callback was not specified.
TypeError: A dynamic import callback was not specified.
    at new NodeError (node:internal/errors:387:5)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:39:9)
    at Object.<anonymous> (/path/to/project/root/node_modules/prettier/index.cjs:600:23)
    at Module.u._compile (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:4:1271)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1243:10)
    at Module.load (node:internal/modules/cjs/loader:1058:32)
    at Module._load (node:internal/modules/cjs/loader:893:12)
    at Function.f._load (node:electron/js2c/asar_bundle:2:13330)
    at Function.b._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:126:29948)
    at Function.h._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:126:26698)
    at Function.I._load (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:90:24489)
    at Module.require (node:internal/modules/cjs/loader:1082:19)
    at Module.require (/path/home/.vscode/extensions/github.copilot-1.88.132/dist/extension.js:8:366722)
    at t.ModuleResolver.g (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js:4:647)
    at t.ModuleResolver.loadNodeModule (/path/home/.vscode/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:6406)
    at t.ModuleResolver.getPrettierInstance (/path/home/.vscode/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:4086)
    at t.default.handleActiveTextEditorChanged (/path/home/.vscode/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:9843)
    at t.default.handleActiveTextEditorChangedSync (/path/home/.vscode/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:9445)
    at t.default.registerDisposables (/path/home/.vscode/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:12288)
    at /path/home/.vscode/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:77862

Using [email protected] and prettier-vscode at 9.13.0

@jmatsushita
Copy link
Author

jmatsushita commented Jun 10, 2023

Strangely, I did find a bizarre workaround. When I patch the prettier/index.cjs file to await import("./index.mjs"); I get an error on module load

/Users/jun/dev/workshop/iios/node_modules/prettier/index.cjs:600
var prettierPromise = await import("./index.mjs");
                      ^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules

But somehow the extension recovers and after that formatting works (though the vscode extension logs show the error each time). Not a recommended workaround, but maybe it will help identify the underlying issue?

EDIT: this breaks other things, do not use!

@kachkaev
Copy link
Member

👋 @jmatsushita!

Prettier v3 alpha does not work in VS Code (yet) – see prettier/prettier-vscode#2947 (comment) and below for details.

Let’s close this issue because this repo is related to Prettier core, not its integration. I am also waiting for VS Code support for the upcoming v3 🤞

@kachkaev kachkaev closed this as not planned Won't fix, can't repro, duplicate, stale Jun 10, 2023
@kachkaev kachkaev added the scope:external This is not an issue with Prettier, it’s an issue with external software, like an editor integration label Jun 10, 2023
@jmatsushita
Copy link
Author

Great thanks 🙏

@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Nov 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. scope:external This is not an issue with Prettier, it’s an issue with external software, like an editor integration
Projects
None yet
Development

No branches or pull requests

2 participants