systeminformation: trying to webpack bundle - Module not found: Error: Can't resolve 'osx-temperature-sensor' and 'child_process'

Describe the bug trying to build Webpack with no intention of using osx-temprarture-sensor, and not invoking that systeminformation function.

If there a way to tell the build process not to include the osx-temprarture-sensor package. I I do try and add that as a package dependency it then required and has smc dependency issues, that ideally, I’d rather not then deal with.

I expect this is somewhat related: https://github.com/sebhildebrandt/systeminformation/issues/25

To Reproduce Steps to reproduce the behavior:

  1. used function ‘…’
  2. code snippet ‘…’
  3. start app / code
  4. See output/error ‘…’
Module not found: Error: Can't resolve 'osx-temperature-sensor' in...' 

Current Output If applicable, add output to help explain your problem.

Expected behavior A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • systeminformation package version:
  • OS: [e.g. macOS] macOS - but also building on linux etc.
  • Hardware [e.g. MacBook Pro 13]

Additional context Add any other context about the problem here.

trying to use Webpack.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Not working for me. I´am using webpack 5; altough including the snippet above (new webpack.IgnorePlugin(/osx-temperature-sensor/) webpack throws the following error: WARNING in ./node_modules/systeminformation/lib/cpu.js 1107:20-53 Module not found: Error: Can't resolve 'osx-temperature-sensor' in '[PATH TO NODE_MODULES]/node_modules/systeminformation/lib' @ ./node_modules/systeminformation/lib/index.js 28:12-28 @ ./source/main/index.ts 10:42-70 Can anyone help?

EDIT: [SOLUTION]: For anyone having the same problem: wepback 5 changed the syntax, this is the solution for webpack 5: new webpack.IgnorePlugin({ resourceRegExp: /osx-temperature-sensor$/, }),

Hi guys. This helped me.

module.exports = {
  plugins: [
    new webpack.IgnorePlugin(/osx-temperature-sensor/)
  ]
}

No more warning.