AykutSarac / jsoncrack-vscode

VS Code extension of JSON Crack. Convert your JSON files into graphs with a single click and view them onto graphs.
https://marketplace.visualstudio.com/items?itemName=AykutSarac.jsoncrack-vscode
MIT License
407 stars 45 forks source link

I can not build the extension. Error Child compilation failed: #1

Closed KarlHeitmann closed 2 years ago

KarlHeitmann commented 2 years ago

Hi,

I'm getting an error that prevents the extension to be built.

I've ran the scripts start, compile and watch, but they are not working. After running these commands, and keep the watch running on the terminal, I've launched the script "Run extension" configuration located in .vscode/launch.json file, and I get this error:

Activating extension 'AykutSarac.jsoncrack-vscode' failed: Cannot find module '/home/karl/github/jsoncrack-vscode/build/ext-src/extension.js'
Require stack:
- /usr/share/code/resources/app/out/vs/loader.js
- /usr/share/code/resources/app/out/bootstrap-amd.js
- /usr/share/code/resources/app/out/bootstrap-fork.js.

It appears the extension could not be activated.

If I check localhost:3000 I've got this error

Html Webpack Plugin:

  Error: Child compilation failed:
  [eslint] Must use import to load ES Module: /home/karl/github/jsoncrack-vscode/node_modules/@eslint/eslintrc/universal.js
  require() of ES modules is not supported.
  require() of /home/karl/github/jsoncrack-vscode/node_modules/@eslint/eslintrc/universal.js from /home/karl/github/jsoncrack-vscode/node_modules/eslint/lib/linter/linter.js is an ES modul  e file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
  Instead rename universal.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/karl/github/jsoncrack-vscode/node_modules/@eslint/eslintrc/pa  ckage.json.

  - child-compiler.js:169 
    [jsoncrack-vscode]/[html-webpack-plugin]/lib/child-compiler.js:169:18

  - Compiler.js:551 finalCallback
    [jsoncrack-vscode]/[webpack]/lib/Compiler.js:551:5

  - Compiler.js:577 
    [jsoncrack-vscode]/[webpack]/lib/Compiler.js:577:11

  - Compiler.js:1196 
    [jsoncrack-vscode]/[webpack]/lib/Compiler.js:1196:17

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5

  - task_queues.js:66 runNextTicks
    internal/process/task_queues.js:66:3

  - timers.js:429 processImmediate
    internal/timers.js:429:9

I think maybe it's an issue due to the stack I'm using to build the project. I've user first node version v12.16.2 and then v16.17.0. But it may be a mismatch.

To get the extension working, I needed to build the extension using the script build: yarn build. This command compiles the extension, and then I can launch the Run extension and I get the extension running. But it will be nice to have a dev script working, so when I modify a specific file, the extension gets automatically compiled and I can quickly test my changes.

AykutSarac commented 2 years ago

Hello!

I've added Development Instructions at README.md. Basically, you should run yarn watch-build and start debugging. When you make changes you should restart debugging to view changes.