React Component for splunk dont compile with error

43 Views Asked by At

Im trying to follow this tutorial https://splunkui.splunk.com/Create/ComponentTutorial and i have a problem when i start the demo. The steps that im following are:

  • Navigate to an empty directory of your choice and invoke Create:
mkdir -p ~/Code/MyTodoList && cd ~/Code/MyTodoList
npx @splunk/create

(I choose A monorepo with a React Component)

  • Run setup and start the component in demo mode
yarn run setup
cd packages/react-todo-list
yarn run start:demo

This bring me back the following errors:

ERROR in ../../node_modules/@splunk/splunk-utils/url.js 11:19-41
Module not found: Error: Can't resolve 'querystring' in 'c:\SPLUNK\Code\MyTodoList\node_modules\@splunk\splunk-utils'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }'
        - install 'querystring-es3'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "querystring": false }
resolve 'querystring' in 'c:\SPLUNK\Code\MyTodoList\node_modules\@splunk\splunk-utils'
  Parsed request is a module
  using description file: c:\SPLUNK\Code\MyTodoList\node_modules\@splunk\splunk-utils\package.json

(relative path: .) Field 'browser' doesn't contain a valid alias configuration resolve as module c:\SPLUNK\Code\MyTodoList\node_modules@splunk\splunk-utils\node_modules doesn't exist or is not a directory c:\SPLUNK\Code\MyTodoList\node_modules@splunk\node_modules doesn't exist or is not a directory c:\SPLUNK\Code\MyTodoList\node_modules\node_modules doesn't exist or is not a directory looking for modules in c:\SPLUNK\Code\MyTodoList\node_modules single file module using description file: c:\SPLUNK\Code\MyTodoList\package.json (relative path: ./node_modules/querystring) no extension Field 'browser' doesn't contain a valid alias configuration c:\SPLUNK\Code\MyTodoList\node_modules\querystring doesn't exist .wasm Field 'browser' doesn't contain a valid alias configuration c:\SPLUNK\Code\MyTodoList\node_modules\querystring.wasm doesn't exist .mjs Field 'browser' doesn't contain a valid alias configuration c:\SPLUNK\Code\MyTodoList\node_modules\querystring.mjs doesn't exist .js Field 'browser' doesn't contain a valid alias configuration c:\SPLUNK\Code\MyTodoList\node_modules\querystring.js doesn't exist .jsx Field 'browser' doesn't contain a valid alias configuration c:\SPLUNK\Code\MyTodoList\node_modules\querystring.jsx doesn't exist .ts Field 'browser' doesn't contain a valid alias configuration c:\SPLUNK\Code\MyTodoList\node_modules\querystring.ts doesn't exist .tsx Field 'browser' doesn't contain a valid alias configuration c:\SPLUNK\Code\MyTodoList\node_modules\querystring.tsx doesn't exist c:\SPLUNK\Code\MyTodoList\node_modules\querystring doesn't exist c:\SPLUNK\Code\node_modules doesn't exist or is not a directory c:\SPLUNK\node_modules doesn't exist or is not a directory c:\node_modules doesn't exist or is not a directory @ ../../node_modules/@splunk/splunk-utils/themes.js 12:11-46 @ ./demo/demo.jsx 7:0-76 9:0-12 11:20-35

How can i handle this?

Thx in advance.

node -v v20.11.1

npm -v 10.2.4

yarn -v 1.22.22

0

There are 0 best solutions below