wallabyjs / quokka

Repository for Quokka.js questions and issues
https://quokkajs.com
1.17k stars 31 forks source link

Quokka won't find "@asamuzakjp/dom-selector" module #928

Closed tostimontes closed 8 months ago

tostimontes commented 9 months ago

Issue description or question

Is this issue related to Quokka not outputting the expected results of your code?: _No I installed JSDOM to be able for browser emulation. Then I encountered the output shown below. I tried to use the output install link for the #asamuzakjp package but it won't work. I installed it both in my .quokka directory and my project directory, but it still outputs the same error.

Sample code

function gameLogic() {
  return {
    rounds: 0,
    resetScoreboard: function () {

    },
    resetGameboard: function (arr) {
      for (let i = 0; i < arr.length; i++) {
        for (let j = 0; j < arr[i].length; j++) {
          arr[i][j] = "";
        }
      }
    },
  };
}

function setGameboard() {
  return [
    [, ,],
    [, ,],
    [, ,],
  ];
}

function createPlayer(name, markerSelector) {
  return {
    name: name,
    marker: markerSelector ? "X" : "O",
    score: 0,
    markTile: function (row, column) {
      gameboard[row][column] === undefined
        ? (gameboard[row][column] = this.marker)
        : null;
    },
    winRound: function () {
      console.log(`${this.name} won the round!`);
      ++this.score;
    },
  };
}
// PLAYGROUND
const gameboard = setGameboard();
const aitor = createPlayer("Aitor", true);
const matxin = createPlayer("Matxin", false);

Sample repository link

If the issue can not be reproduced just using the quokka file above (for example because it requires/imports some files from your project), please create a small repository where the issue can be reproduced.

Quokka.js Console Output

​​​​​Quokka PRO 'script.js' (node: v18.17.1, plugins: jsdom-quokka-plugin)​​​​

​Install "@asamuzakjp/dom-selector" package for the current quokka file​
​Install "@asamuzakjp/dom-selector" package into the project​
 
Cannot find module '@asamuzakjp/dom-selector' 
Require stack: 
- C:\Users\Aitor\.quokka\node_modules\jsdom\lib\jsdom\living\helpers\selectors.js 
- C:\Users\Aitor\.quokka\node_modules\jsdom\lib\jsdom\living\helpers\style-rules.js 
- C:\Users\Aitor\.quokka\node_modules\jsdom\lib\jsdom\living\nodes\Node-impl.js 
- C:\Users\Aitor\.quokka\node_modules\jsdom\lib\jsdom\living\generated\Node.js 
- C:\Users\Aitor\.quokka\node_modules\jsdom\lib\jsdom\living\generated\Attr.js 
- C:\Users\Aitor\.quokka\node_modules\jsdom\lib\jsdom\living\generated\NamedNodeMap.js 
- C:\Users\Aitor\.quokka\node_modules\jsdom\lib\jsdom\living\interfaces.js 
- C:\Users\Aitor\.quokka\node_modules\jsdom\lib\jsdom\browser\Window.js 
- C:\Users\Aitor\.quokka\node_modules\jsdom\lib\api.js 
- .\index.js 

Code editor version

Visual Studio Code v 1.85.1

OS name and version

Windows 11 - 22H2 (OS Build 22621.2861)

mburnell commented 8 months ago

Thanks for reporting this issue. The recently-released jsdom 23.2.0 has swapped out its css selector engine (previously nwsapi, now @asamuzakjp/dom-selector), and it's this new engine that is failing to load in Quokka. We can reproduce the issue, and are working on a resolution. Until then, please use jsdom 23.1.0 or earlier.

mburnell commented 8 months ago

We've added support for jsdom 23.2.0+ to Quokka for all supported platforms; please update to Quokka for VS Code 1.0.612+ in order to receive this update.