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

Extension not working on macos on 1.88.1 #577

Open
remixer-dec opened this issue Apr 28, 2024 · 3 comments
Open

Extension not working on macos on 1.88.1 #577

remixer-dec opened this issue Apr 28, 2024 · 3 comments

Comments

@remixer-dec
Copy link

Activating extension ban.spellright failed due to an error:
2024-04-29 01:32:00.927 [error] Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/user/.vscode-oss/extensions/ban.spellright-3.0.124-universal/node_modules/os-locale/index.js from /Users/user/.vscode-oss/extensions/ban.spellright-3.0.124-universal/src/spellright.js not supported.
Instead change the require of index.js in /Users/user/.vscode-oss/extensions/ban.spellright-3.0.124-universal/src/spellright.js to a dynamic import() which is available in all CommonJS modules.

Version: 1.88.1
Release: 24104
Commit: 0d01a72525276e5e3771fe5851b9c83de0de1e2b
Date: 2024-04-13T01:43:30.924Z
Electron: 28.2.8
ElectronBuildId: undefined
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
ОС: Darwin arm64 23.4.0

@remixer-dec
Copy link
Author

remixer-dec commented Apr 28, 2024

const osLocale = require('os-locale');

Wrapped it with an import as suggested

let osLocale
import('os-locale')
    .then(module => (osLocale = module))
    .catch(error => console.error('Error during dynamic import:', error));
// haven't tested if it is imported correctly, rollback to a version that supports require imports may be a better solution

and faced another error:

Warning

TypeError: glob is not a function
at loadBinary (/Users/user/.vscode-oss/extensions/ban.spellright-3.0.124-universal/lib/bindings.js:18:21)
at Object. (/Users/user/.vscode-oss/extensions/ban.spellright-3.0.124-universal/lib/bindings.js:44:12)

fixed it by changing

const glob = require('glob');

const glob = require('glob');

to

const {glob} = require("glob") 

and

const nodeFiles = glob(path.join(__dirname, `bin/${baseName}*${process.arch}*.node`), { sync: true });

const dictionaryFiles = glob(path.join(pathName, '.vscode', '*.dict', ''), { sync: true });

to

- glob(
+ glob.sync(

After saving and restarting the editor, the extension seems to be working correctly.
P.S. I suggested a workaround to make it work, it may not be the best way to handle backwards compatibility, but idk what really caused this issue in the first place.

@j-lakeman
Copy link

j-lakeman commented May 5, 2024

@AVAtarMod
Copy link

#577 (comment)

After saving and restarting the editor, the extension seems to be working correctly.

I used this on VSCodium 1.89.1 and this works. Thanks.

OS: Linux (Fedora 39)

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

No branches or pull requests

3 participants