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
Webpack #1529
Comments
+1, also seeing this Output:
|
I figured it out. The problem is that Webpack requires some extra config unlike browserify due to it's more barebones nature. See my example branch and diff for how I got the tests to run successfully. master...pho3nixf1re:webpack-tests My plan is to turn that into it's own karma test and submit a PR so others can use it as an example. Also, it may uncover future issues as development progresses. |
Yeah, found the same, thanks. For anyone else that stumbles across this, the relevant webpack docs are here: http://webpack.github.io/docs/configuration.html#node |
@jaredmcdonald thanks a lot :) |
@pho3nixf1re it would be great if you submit a PR about testing request with webpack (additional test, not in place of the browserify one) 👍 |
Yes! I intend to. I only replaced it in my branch as a quick proof of concept. I'll get on that this weekend. |
Adding the json webpack loader unfortunately did not fix this for me. |
Same issue here. The solution: install $ npm install --save-dev json-loader webpack.config.js var path = require('path');
module.exports = {
entry: 'index',
output: {
path: path.join(__dirname, 'scripts'),
filename: 'bundle.js'
},
module: {
loaders: [
{ test: /\.json$/, loader: 'json-loader' }
]
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js']
},
node: {
console: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty'
}
}; |
This adds a configuration for Webpack as a reference to anyone using it over Browserify since it requires some special configuration to work. There is a TODO task here to make the tests run with both Webpack and Browserify configs in series, but that will take some work as the current test setup won't allow that easily. For now, having this example will help others to figure out how to get request working with Webpack. This closes request#1529
This adds a configuration for Webpack as a reference to anyone using it over Browserify since it requires some special configuration to work. There is a TODO task here to make the tests run with both Webpack and Browserify configs in series, but that will take some work as the current test setup won't allow that easily. For now, having this example will help others to figure out how to get request working with Webpack. This closes request#1529
Adding the |
I just figured it out:
|
This adds a configuration for Webpack as a reference to anyone using it over Browserify since it requires some special configuration to work. There is a TODO task here to make the tests run with both Webpack and Browserify configs in series, but that will take some work as the current test setup won't allow that easily. For now, having this example will help others to figure out how to get request working with Webpack. This closes request#1529
This adds a configuration for Webpack as a reference to anyone using it over Browserify since it requires some special configuration to work. There is a TODO task here to make the tests run with both Webpack and Browserify configs in series, but that will take some work as the current test setup won't allow that easily. For now, having this example will help others to figure out how to get request working with Webpack. This closes request#1529
This was a huge help for me. Thanks to all above. |
Thanks all, bumped into this myself. |
any luck? |
I'm using webpack & request and got the error you all got here. |
Hi. I need help. I want to combine node js mysql into my react app. But i got error message cannot resolve module 'net' when i run the webpack.
|
+1 |
+1 |
+1 I had problems with |
Adding node |
While the node {} solution above helped my webpack.config.js it broke my karma.conf.js which depends on it, with the following error: ReferenceError: Strict mode forbids implicit creation of global property '_crypto' |
For peeps who have trouble with storybook and don't want to replace storybook's original webpack config, you can extend it by creating // Load the default config generator.
const genDefaultConfig = require('@kadira/storybook/dist/server/config/defaults/webpack.config.js');
module.exports = function (config, env) {
const newConfig = genDefaultConfig(config, env);
// Extend to resolve fs issues
newConfig.node = {
fs: 'empty'
};
return newConfig;
}; |
Using this above code error has been solved but
fs.writeFile is not working please give any solution. |
@chandrasekarb try set fs to true instead of 'empty' |
|
I ran into this issue and it was because I was running a dual client/server config for server side rendering. The server-side rendering config was marked as target: 'node', while the client config didn't have one specified. I added target: 'web' to the client config and the error went away. |
request-promiseを使うためにrequest、request-promise、json-loaderのインストールとwebpackの設定が必要だった。 request/request#1529 この設定しないとbuildした際にモジュールが見つからないって怒られる。
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Request is now in maintenance mode and wont be merging any new features or addressing this bug. Please see #3142 for more information. |
I had the same issue trying to use |
I'm attempting to load
request
using Webpack and am seeing this error:I have seen that this is supposed to work in the browser using browserify and was curious what I'm doing wrong. Maybe browserify processes the dependencies differently from webpack which is causing this issue. Any ideas?
The text was updated successfully, but these errors were encountered: