-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
trying to webpack bundle - Module not found: Error: Can't resolve 'osx-temperature-sensor' and 'child_process' #230
Comments
@acds: just to be clear: are you trying to build a client/frontend side app (like with a framework like react or angular) or is it server/backend side (node js or eventually electron)? If you are trying to build the first one: this will not work! Systeminformation is only intended do be used server/backend side. If you build a server/backend side app, can you point me to some code how you are using webpack here? |
Hi @sebhildebrandt - Yes its server side. I'm using .Net Core Node Services. I have the js script as an embedded resources taking advantage of with the javascript like this: const osxTemp = require('systeminformation');
module.exports = {
mdfg_mem: function(callback, seed) {
console.log("in mem");
let result = null;
si.mem()
.then( data => {
console.log(data);
callback(null, data);
}
else
{
callback(null, null);
}
})
.catch(error => {
callback(error, null);
});
}
}; However, on deployment (outside of development) I need to copy the Alternatively I can setup Webpack to generate a bundled Here is the {
"name": "xxxx",
"version": "1.0.0",
"description": "Description",
"main": "./Scripts/index.js",
"scripts": {
"build:debug": "webpack --mode=development --config webpack.config.js --progress --profile",
"build:production": "webpack --mode=production --config webpack.config.js --progress --profile",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "xxxxxx",
"license": "ISC",
"dependencies": {
"systeminformation": "^4.5.1"
},
"devDependencies": {
"ts-loader": "^6.0.1",
"typescript": "^3.4.5",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2"
}
} and const path = require('path');
const webpack = require('webpack');
module.exports = (env, args) =>({
resolve: {
extensions: ['.ts', '.js']
},
devtool: args.mode === 'development' ? 'inline-source-map' : 'none',
module: {
rules: [
{
test: /\.ts?$/,
loader: 'ts-loader'
}
]
},
entry: {
'index' : './Scripts/myfile.js',
},
output: {
path: path.join(__dirname, '/Scripts'),
filename: '[name].js'
}
}); hoverer I get the following errors:
|
I did not worked with webpack on backend side ... but I found this blog post https://medium.com/code-oil/webpack-javascript-bundling-for-both-front-end-and-back-end-b95f1b429810 and according to this (at the end of the post) you would need to add to your config:
I guess you need to play around a little with this ... can you provide the correct answer, if you have success with it ...? |
@acds : Did you had time to play around with the web pack options? As this is probably not really an issue of systeminformation, I would like to close the issue. But I would be happy if you post your progress here for reference. |
Closing this, seems not to be an issue of systeminformation, rather than web pack configuration. |
Hey @sebhildebrandt! Thanks for finding this. I'm also having this problem, but when I try adding the suggested code to the end of my webpack configuration, I get an error and some warnings. Any advice you could provide would be helpful. |
Realized I needed to quote it. Regardless, it still does not fix the module not found warning :) |
Just to be sure: can you provide your package.json? |
@adambailey- not sure if you were notified ... Can you provide your package.json? |
Sure! I've removed some information in there that is definitely not useful (mostly release and testing information). It's worth noting that this is an Electron app, and that the warning is especially visible when using
|
@adambailey- for OS X you also need to add
|
@adambailey- ... which you probably then also need to add to the webpack config ... just a suggestion as I do not work with webpack at backend: so something like this:
|
Same error. By the way, our Webpack setup isn't what that article is describing with a frontend and backend config. We have one config, whose target is
|
Hi guys. This helped me. module.exports = {
plugins: [
new webpack.IgnorePlugin(/osx-temperature-sensor/)
]
} No more warning. |
Thank you so much! |
Not working for me. EDIT: [SOLUTION]: |
// for target web
|
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: #25
To Reproduce
Steps to reproduce the behavior:
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):
Additional context
Add any other context about the problem here.
trying to use Webpack.
The text was updated successfully, but these errors were encountered: