我正在安装一个React启动应用程序,添加了Webpack,但它显示“Can't resolve './src/index.js'”。
浏览器显示
我的文件路径和Package.json内容
Webpack.config.js 内容
![My app gives this look](https://istack.dev59.com/fhNa8.webp)
![enter image description here](https://istack.dev59.com/zHqU1.webp)
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
var path = require('path');
module.exports = {
context: path.join(__dirname, "public"),
devtool: debug ? "inline-sourcemap" : false,
entry: "./src/index.js",
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2016', 'stage-0'],
plugins: ['react-html-attrs', 'transform-decorators-legacy', 'transform-class-properties'],
}
}
]
},
output: {
path: __dirname + "/public/",
filename: "build.js"
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
],
};
ERROR in ./src/index.js 模块构建失败:错误:相对于目录"C:\\Users\\ashik\\Desktop"找不到预设"es2016"
但我收到了新的错误。 - MD Ashik