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

[script-compiler] compile error with textlint-rule-prh #88

Closed
tkhk opened this issue Apr 3, 2024 · 4 comments · Fixed by #89
Closed

[script-compiler] compile error with textlint-rule-prh #88

tkhk opened this issue Apr 3, 2024 · 4 comments · Fixed by #89

Comments

@tkhk
Copy link

tkhk commented Apr 3, 2024

Upon enabling the latest version of textlint-rule-prh https://github.com/textlint-rule/textlint-rule-prh and executing textlint-script-compiler, I get an error related to module resolution.

[
  {
    moduleIdentifier: 'node:os',
    moduleName: 'node:os',
    message: 'Module build failed: UnhandledSchemeError: Reading from "node:os" is not handled by plugins (Unhandled scheme).\n' +
      'Webpack supports "data:" and "file:" URIs by default.\n' +
      'You may need an additional plugin to handle "node:" URIs.\n' +
      '    at /workspace/node_modules/webpack/lib/NormalModule.js:838:25\n' +
      '    at Hook.eval [as callAsync] (eval at create (/workspace/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)\n' +
      '    at Object.processResource (/workspace/node_modules/webpack/lib/NormalModule.js:835:8)\n' +
      '    at processResource (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:220:11)\n' +
      '    at iteratePitchingLoaders (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:171:10)\n' +
      '    at runLoaders (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:397:2)\n' +
      '    at NormalModule._doBuild (/workspace/node_modules/webpack/lib/NormalModule.js:825:3)\n' +
      '    at NormalModule.build (/workspace/node_modules/webpack/lib/NormalModule.js:969:15)\n' +
      '    at /workspace/node_modules/webpack/lib/Compilation.js:1377:12\n' +
      '    at NormalModule.needBuild (/workspace/node_modules/webpack/lib/NormalModule.js:1257:32)',
    moduleId: 2999,
    moduleTrace: [ [Object], [Object] ],
    details: undefined,
    stack: 'ModuleBuildError: Module build failed: UnhandledSchemeError: Reading from "node:os" is not handled by plugins (Unhandled scheme).\n' +
      'Webpack supports "data:" and "file:" URIs by default.\n' +
      'You may need an additional plugin to handle "node:" URIs.\n' +
      '    at /workspace/node_modules/webpack/lib/NormalModule.js:838:25\n' +
      '    at Hook.eval [as callAsync] (eval at create (/workspace/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)\n' +
      '    at Object.processResource (/workspace/node_modules/webpack/lib/NormalModule.js:835:8)\n' +
      '    at processResource (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:220:11)\n' +
      '    at iteratePitchingLoaders (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:171:10)\n' +
      '    at runLoaders (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:397:2)\n' +
      '    at NormalModule._doBuild (/workspace/node_modules/webpack/lib/NormalModule.js:825:3)\n' +
      '    at NormalModule.build (/workspace/node_modules/webpack/lib/NormalModule.js:969:15)\n' +
      '    at /workspace/node_modules/webpack/lib/Compilation.js:1377:12\n' +
      '    at NormalModule.needBuild (/workspace/node_modules/webpack/lib/NormalModule.js:1257:32)\n' +
      '    at processResult (/workspace/node_modules/webpack/lib/NormalModule.js:764:19)\n' +
      '    at /workspace/node_modules/webpack/lib/NormalModule.js:866:5\n' +
      '    at /workspace/node_modules/loader-runner/lib/LoaderRunner.js:399:11\n' +
      '    at /workspace/node_modules/loader-runner/lib/LoaderRunner.js:221:19\n' +
      '    at /workspace/node_modules/webpack/lib/NormalModule.js:838:16\n' +
      '    at Hook.eval [as callAsync] (eval at create (/workspace/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)\n' +
      '    at Object.processResource (/workspace/node_modules/webpack/lib/NormalModule.js:835:8)\n' +
      '    at processResource (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:220:11)\n' +
      '    at iteratePitchingLoaders (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:171:10)\n' +
      '    at runLoaders (/workspace/node_modules/loader-runner/lib/LoaderRunner.js:397:2)',
    compilerPath: undefined
  },

It seems that the direct cause of this issue is related to adding node:path and node:os.
textlint-rule/textlint-rule-prh#104

Although script-compiler use node-polyfill-webpack-plugin, it has come to my attention that Webpack's resolve.fallback setting does not inherently support URIs with the node: prefix.
webpack/webpack#14166

I’m not familiar with JavaScript and Node.js.
I wonder if there are any known solutions or workarounds to this issue.

@azu
Copy link
Member

azu commented Apr 3, 2024

What's version of node.js?

$ node --version

@tkhk
Copy link
Author

tkhk commented Apr 3, 2024

I forgot to include the version information.

$ node --version
v20.12.0
$ yarn list | grep -e script-compiler -e textlint-rule-prh
├─ @textlint/[email protected]
│  ├─ textlint-rule-prh@^5.3.0
│  └─ [email protected]
├─ [email protected]

I tried with Node.js v18, I got the same issue.

$ node --version
v18.20.0

@azu azu linked a pull request Apr 3, 2024 that will close this issue
@azu
Copy link
Member

azu commented Apr 3, 2024

Thanks.
I confirmed it. Its looks like webpack and node-polyfill-webpack-plugin problem.

@azu azu closed this as completed in #89 Apr 3, 2024
@azu
Copy link
Member

azu commented Apr 3, 2024

Fixed in https://github.com/textlint/editor/releases/tag/v0.17.0

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

Successfully merging a pull request may close this issue.

2 participants