我对节点的东西很新,我试图弄明白我为什么会这样做 this error
这个错误发生在我需要蒸汽模块的第一行:" var steam = require(' steam')"。 显然,GET请求的目标是错误的地方,至少应该是http://localhost:8080/protobufs/ ...'正确获取资源。我的webpack配置或package.json可能有问题吗?
有没有非常全面的例子如何开始使用node-steam?我使用的是最新节点(v7.7.0)和npm(v4.1.2)。
编辑:这是package.json
{
"name": "steam-test",
"version": "1.0.0",
"description": "",
"main": "js/login.js",
"scripts": {
"webpack": "webpack",
"babel": "babel",
"start": "webpack-dev-server"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-cli": "^6.23.0",
"babel-core": "^6.23.1",
"babel-loader": "^6.3.2",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.23.0",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"steam": "^1.4.0",
"webpack": "^2.2.1"
}
}
和webpack.config.js
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: path.join(__dirname, '/js/login.js'),
output: {
path: path.join(__dirname, '/build'),
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
include: [/js/],
exclude: [/node_modules/],
query: {
cacheDirectory: true,
presets: ['es2015', 'react']
}
}
]
},
resolve: {
extensions: ['.js', '.jsx']
},
stats: {
colors: true
},
node: {
fs: 'empty',
net: 'empty',
tls: 'empty'
},
watch: true
};