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

Ignore a webpack warning from vscode-languageserver-textdocument #1051

Merged

Conversation

TamiTakamiya
Copy link
Collaborator

@TamiTakamiya TamiTakamiya commented Jan 17, 2024

We started seeing the following error when we run yarn run webpack:

ERROR in ./node_modules/vscode-languageserver-textdocument/lib/umd/main.js 12:24-31
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
    at CommonJsRequireContextDependency.getWarnings (/home/ttakamiy/git/TamiTakamiya/vscode-ansible/node_modules/webpack/lib/dependencies/ContextDependency.js:109:18)
    at Compilation.reportDependencyErrorsAndWarnings (/home/ttakamiy/git/TamiTakamiya/vscode-ansible/node_modules/webpack/lib/Compilation.js:3140:24)
    at /home/ttakamiy/git/TamiTakamiya/vscode-ansible/node_modules/webpack/lib/Compilation.js:2737:28
    at _next2 (eval at create (/home/ttakamiy/git/TamiTakamiya/vscode-ansible/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:34:1)
    at eval (eval at create (/home/ttakamiy/git/TamiTakamiya/vscode-ansible/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:62:1)
    at /home/ttakamiy/git/TamiTakamiya/vscode-ansible/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:380:10
    at /home/ttakamiy/git/TamiTakamiya/vscode-ansible/node_modules/neo-async/async.js:2830:7
    at Object.each (/home/ttakamiy/git/TamiTakamiya/vscode-ansible/node_modules/neo-async/async.js:2850:39)
    at /home/ttakamiy/git/TamiTakamiya/vscode-ansible/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:356:17
    at /home/ttakamiy/git/TamiTakamiya/vscode-ansible/node_modules/neo-async/async.js:2830:7
 @ ./node_modules/@ansible/ansible-language-server/out/server/src/server.js 3:45-90

webpack 5.89.0 compiled with 1 error in 74784 ms

It is considered as the same error as the one described in this issue, which suggests two changes in webpack config (webpack.config.ts) to deal with the problem:

First one (for a "web extension")

resolve: {
			mainFields: ['browser', 'module', 'main'],

Second one (for a "desktop extension")

resolve: {
			conditionNames: ['import', 'require'],
			mainFields: ['module', 'main'],

I found the second one fix the build issue, but the generated extension showed the following error at runtime:

crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported

I think it would be less risky to ignore the warning (note: we are using WarningsToErrorsPlugin) instead of adding some parameters to webpack config. This PR contains the change in webpack.config.ts to ignore the warning.


This PR also includes:

  • Fix the mismatch between @types/vscode and vscode dependences
  • Fix for a lint error (src/utils/telemetryUtils.ts)
  • Fix for misterious lint errors on tsconfig.json and .devcontainer/devcontainer.json (Ref)
prettier.................................................................Failed
- hook id: prettier
- files were modified by this hook

25htsconfig.json
25h25h.devcontainer/devcontainer.json
25h

Note: I have no idea what those 25h are...

@ganeshrn ganeshrn merged commit b1b0dc0 into ansible:main Jan 18, 2024
8 checks passed
Copy link
Contributor

Label error. Requires exactly 1 of: bug, enhancement, major, minor, patch, skip-changelog. Found: bug, skip-changelog, AAP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AAP Ansible automation platform bug Something isn't working skip-changelog
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants