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

Upgrade to Shudan 1.7.x #883

Merged
merged 3 commits into from
Aug 14, 2022
Merged

Upgrade to Shudan 1.7.x #883

merged 3 commits into from
Aug 14, 2022

Conversation

apetresc
Copy link
Member

This required an upgrade from Webpack 4 to Webpack 5 because Shudan 1.7.0 makes use of the nullish coalescing operator '??' which Webpack 4 fails to parse. Luckily, this was a pretty painless migration.

Closes #882.

Webpack 4 fails to parse the nullish coalescing operator '??' which
Shudan 1.7.0 uses.
@apetresc
Copy link
Member Author

Hmm, so webpack --mode production was working fine with Shudan 1.7.0 last night, but something in Shudan 1.7.1 this morning has broken it again. Needs investigation.

@apetresc
Copy link
Member Author

apetresc commented Aug 13, 2022

@yishn Do you have any insight here? It seems there's some sort of incompatibility with how imports are resolved. Ever since SabakiHQ/Shudan@966c924 Sabaki is translating's Shudan's require("preact/hooks") into a search path of [..]/node_modules/preact/dist/preact.min.js/hooks[.js|.json|.wasm] which clearly seems wrong. I'm not fluent enough in all the new Node/ES/Webpack churn to make sense of which component's fault this is, do you have an idea off the top of your head?

Relevant stack trace:

ERROR in ./node_modules/@sabaki/shudan/src/Vertex.js 2:0-43
Module not found: Error: Can't resolve 'preact/hooks' in '/home/apetresc/src/personal/sabaki/Sabaki/node_modules/@sabaki/shudan/src'
resolve 'preact/hooks' in '/home/apetresc/src/personal/sabaki/Sabaki/node_modules/@sabaki/shudan/src'
  Parsed request is a module
  using description file: /home/apetresc/src/personal/sabaki/Sabaki/node_modules/@sabaki/shudan/package.json (relative path: ./src)
    aliased with mapping 'preact': '/home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js' to '/home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks'
      using description file: /home/apetresc/src/personal/sabaki/Sabaki/node_modules/@sabaki/shudan/package.json (relative path: ./src)
        Field 'browser' doesn't contain a valid alias configuration
        root path /home/apetresc/src/personal/sabaki/Sabaki
          using description file: /home/apetresc/src/personal/sabaki/Sabaki/package.json (relative path: ./home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /home/apetresc/src/personal/sabaki/Sabaki/home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /home/apetresc/src/personal/sabaki/Sabaki/home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /home/apetresc/src/personal/sabaki/Sabaki/home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks.json doesn't exist
            .wasm
              Field 'browser' doesn't contain a valid alias configuration
              /home/apetresc/src/personal/sabaki/Sabaki/home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks.wasm doesn't exist
            as directory
              /home/apetresc/src/personal/sabaki/Sabaki/home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks doesn't exist
        using description file: /home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/package.json (relative path: ./dist/preact.min.js/hooks)
          no extension
            Field 'browser' doesn't contain a valid alias configuration
            /home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks doesn't exist
          .js
            Field 'browser' doesn't contain a valid alias configuration
            /home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks.js doesn't exist
          .json
            Field 'browser' doesn't contain a valid alias configuration
            /home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks.json doesn't exist
          .wasm
            Field 'browser' doesn't contain a valid alias configuration
            /home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks.wasm doesn't exist
          as directory
            /home/apetresc/src/personal/sabaki/Sabaki/node_modules/preact/dist/preact.min.js/hooks doesn't exist
 @ ./node_modules/@sabaki/shudan/src/Goban.js 16:0-33 158:16-22
 @ ./node_modules/@sabaki/shudan/src/main.js 1:0-31 4:0-31
 @ ./src/components/Goban.js 5:0-43 451:13-25
 @ ./src/components/MainView.js 3:0-30 134:10-15
 @ ./src/components/App.js 12:0-36 362:23-31

webpack 5.74.0 compiled with 1 error in 8222 ms

@yishn
Copy link
Member

yishn commented Aug 14, 2022

I have removed the "preact" alias in webpack.config.js and it seems to be working now

@apetresc
Copy link
Member Author

Indeed, not sure how I missed that :) Though I wish I understood what it was about "type": "module" (presumably) that changes the way the import path is generated.

Thanks @yishn!

@apetresc apetresc merged commit 3ee67cd into master Aug 14, 2022
@yishn
Copy link
Member

yishn commented Aug 15, 2022

I think the reason was the introduction of a preact/hooks Import that did not exist before 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Adopt Shudan 1.7.0
2 participants