gpt4 book ai didi

javascript - MultiMain 错误无法解决目录 webpack 问题

转载 作者:行者123 更新时间:2023-12-03 05:39:55 24 4
gpt4 key购买 nike

我知道这个问题很普遍,但最好的部分是它因人而异

While running webpack server

就我而言,我的文件夹结构是 Folder Structure

我的文件:Webpack.config.js

var path = require('path');
var webpack = require('webpack');
const Files = {
input: path.resolve(__dirname,'src/app'),
output: path.resolve(__dirname,'output')
}
console.log(Files.input);
var config = {
entry: Files.input,
output: {
path: Files.output,
filename: 'index.js',
},
devServer: {
inline: true,
port: 9009
},
resolve: { modulesDirectories: ['node_modules', 'src'], extensions: ['','.js','.jsx'] },
stats: {
colors: true,
modules: true,
reasons: true,
errorDetails: true
},
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}]
}
}

module.exports = config;

包.json

{
"name": "reactapp",
"version": "1.0.0",
"description": "",
"main": "output/index.js",
"scripts": {
"start": "webpack-dev-server --hot"
},
"author": "batman",
"license": "AMIGOS",
"dependencies": {
"babel-cli": "^6.0.0",
"babel-core": "^6.17.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"react": "^15.3.2",
"react-dom": "^15.3.2",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.16.2"
}
}

我也使用虚拟 json 将 package.json 保存在我的应用程序文件夹中 {"name":"hello"}作为开发人员之一建议的一部分。我已经尝试了我附近所有可能的情况,但徒劳无功。请阐明这一点。

更新:将文件夹从 !bharath 更改为 bharath 错误减少到 1。

最佳答案

const Files = {
// you need to specify the file name as well as webpack entry
input: path.resolve(__dirname,'src/app/main.js'),
output: path.resolve(__dirname,'output')
}

关于javascript - MultiMain 错误无法解决目录 webpack 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40579306/

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