gpt4 book ai didi

node.js - 无法将reactjs的webpack 1.5.2更新到webpack 2.0.0

转载 作者:太空宇宙 更新时间:2023-11-04 02:09:36 30 4
gpt4 key购买 nike

我正在使用 VS2015、React.js 和 webpack。我已经安装了所有软件包。但我的系统中默认有 webpack 1.5.2 。我正在尝试更新 webpack 2.0.0,但它不允许我更新该包。它给出如下错误:

/image/GucaN.png

这是 webpack.config.js 文件的代码

var path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var webpack = require('webpack');

module.exports = {
entry: ['./src/app.js'],
output: {
path: path.resolve(__dirname, 'build'),
filename: 'appBundle.js'
},
module: {
loaders: [
{ test: /\.png$/, loader: "url-loader?limit=100000" },
{ test: /\.jpg$/, loader: "file-loader" },
{ test: /\.jpeg$/, loader: "file-loader" },
{ test: /\.gif$/, loader: "file-loader" },
{ test: /\.txt$/, loader: "raw-loader" },
{ test: /\.json$/, loader: "json-loader" },
{ test: /.(woff(2)?|eot|ttf|svg)(\?[a-z0-9=\.]+)?$/, loader: 'url-loader?limit=100000' },
{ test: /\.css$/,loader: ExtractTextPlugin.extract("style-loader", "css-loader")
}, {
loader: 'babel-loader',
exclude: /node_modules/,
test: /\.js$/,
query: {
presets: ['es2015', 'react', 'stage-0'],
},
}]
},
plugins: [
new ExtractTextPlugin("style.css", {
allChunks: true
}),
new webpack.OldWatchingPlugin()
]
};

这是package.json的代码

{

  "scripts": {
"webpack": "webpack --watch --display-modules",
"server": "browser-sync --port 5100 start --server --files \"**/*.html\" \"build/**/*.css\" \"build/**/*.js\" "
},
"devDependencies": {
"babel-core": "^6.24.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.22.0",
"babel-loader": "^6.4.1",
"browser-sync": "^2.18.8",
"css-loader": "^0.27.3",
"extract-text-webpack-plugin": "^2.1.0",
"file-loader": "^0.10.1",
"json-loader": "^0.5.4",
"raw-loader": "^0.5.1",
"style-loader": "^0.14.1",
"url-loader": "^0.5.8",
"webpack": "1.5.2"
},
"dependencies": {
"kendo-ui-react-jquery-barcode": "^1.0.3",
"kendo-ui-react-jquery-charts": "^1.0.3",
"kendo-ui-react-jquery-gantt": "^1.0.2",
"kendo-ui-react-jquery-grid": "^1.0.9",
"kendo-ui-react-jquery-lineargauge": "^1.0.2",
"kendo-ui-react-jquery-mediaplayer": "^1.0.4",
"kendo-ui-react-jquery-pivotgrid": "^1.0.5",
"kendo-ui-react-jquery-qrcode": "^1.0.2",
"kendo-ui-react-jquery-radialgauge": "^1.0.2",
"kendo-ui-react-jquery-scheduler": "^1.0.3",
"kendo-ui-react-jquery-sparklines": "^1.0.2",
"kendo-ui-react-jquery-stockchart": "^1.0.4",
"kendo-ui-react-jquery-treelist": "^1.0.7",
"kendo-ui-react-jquery-treemap": "^1.0.4",
"kendo-ui-react-jquery-treeview": "^1.0.2",
"kendo-ui-react-jquery-upload": "^1.0.4",
"react": "^15.3.2",
"react-dom": "^15.3.2",
"webpack": "1.5.2"
}
}

最佳答案

您可以尝试使用以下命令。它将安装最新稳定版本的 webpack。

npm install --save-dev webpack@2.2.1

此外,您可能想从命令行或在 package.json 文件中轻松检查 webpack 版本..

npm view webpack version

关于node.js - 无法将reactjs的webpack 1.5.2更新到webpack 2.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42855111/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com