由于某种原因,我无法在网上找到讨论此网络包问题的任何地方。我对webpack(以及顺便提一下,React)非常陌生,所以任何帮助都会非常受欢迎,因为我确信这只是我忽视的东西。当我使用webpack编译我的React应用程序时,一切都运行顺利,除了最后一个无用的错误:
trait KeyValue<K, V> {
fn key_value(&self) -> (&K, &V) {
(self.key(), self.value())
}
fn key(&self) -> &K;
fn value(&self) -> &V;
}
impl<K, V> KeyValue<K, V> for (K, V) {
fn key(&self) -> &K {
&self.0
}
fn value(&self) -> &V {
&self.1
}
}
impl<'a, K, V> KeyValue<K, V> for &'a (K, V) {
fn key(&self) -> &K {
&self.0
}
fn value(&self) -> &V {
&self.1
}
}
fn operate<I, T, K, V>(x: I)
where I: IntoIterator<Item=T>,
T: KeyValue<K, V>,
K: AsRef<str>, V: AsRef<str>
{
for p in x {
let (ref k, ref v) = p.key_value();
println!("{}: {}", k.as_ref(), v.as_ref());
}
}
这是我的Time: 2102ms
[0] ./~/process/browser.js 5.3 kB {0} [built]
[5] ./~/react/react.js 56 bytes {0} [built]
[72] ./~/redux/es/index.js 1.08 kB {0} [built]
[121] ./~/redux/es/utils/warning.js 637 bytes {0} [built]
[123] ./src/web/reducers/reducer.js 842 bytes {0} [built]
[124] ./~/react-dom/index.js 59 bytes {0} [built]
[125] ./src/index.css 907 bytes {0} [built]
[130] ./src/web/containers/NewPostHandler.js 1 kB {0} [built]
[131] ./~/css-loader!./src/index.css 290 bytes {0} [built]
[185] ./~/react-dom/lib/ReactDOM.js 5.14 kB {0} [built]
[259] ./~/react-router/lib/index.js 3.62 kB {0} [built]
[276] ./~/redux/es/bindActionCreators.js 1.98 kB {0} [built]
[277] ./~/redux/es/combineReducers.js 5.58 kB {0} [built]
[279] ./~/style-loader/addStyles.js 7.15 kB {0} [built]
[285] ./src/index.js 718 bytes {0} [built]
+ 271 hidden modules
ERROR in chunk main [entry]
bundle.js
this is not a typed array.
:
webpack.config.js
以下是我var path = require("path");
module.exports = {
context: __dirname,
entry: './src/index.js',
output: {
path: __dirname,
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
include: path.join(__dirname,'/src'),
loader: 'babel-loader',
query: {
presets: ['es2015', 'react']
},
},
{
test: /\.css$/,
loader: "style-loader!css-loader"
},
{
test: /\.svg$/,
loader: 'svg-url-loader'
},
],
},
};
的相关位:
package.json
"devDependencies": {
"babel-core": "^6.21.0",
"babel-loader": "^6.2.10",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"css-loader": "^0.26.1",
"react-scripts": "0.7.0",
"redux-devtools": "^3.3.1",
"style-loader": "^0.13.1",
"webpack": "^2.2.0-rc.4"
},
"dependencies": {
"normalizr": "^2.2.1",
"react": "^15.4.0",
"react-dom": "^15.4.0",
"react-redux": "^4.4.6",
"react-router": "^3.0.0",
"redux": "^3.6.0"
},
文件并不特别,但万一需要:
index.js
答案 0 :(得分:0)
今天早上我收到同样的错误。我将节点版本更新为7.2,不再出现此错误。