MultiMain 中的错误无法解决目录 webpack 问题
Error in MultiMain could not resolve directory webpack issue
我知道这个问题很普遍,但最好的部分是它因人而异
在我的例子中,我的文件夹结构是
我的文件:
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;
Package.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"
}
}
我也在我的应用程序文件夹中保存了 package.json 和虚拟 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')
}
我知道这个问题很普遍,但最好的部分是它因人而异
在我的例子中,我的文件夹结构是
我的文件: 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;
Package.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"
}
}
我也在我的应用程序文件夹中保存了 package.json 和虚拟 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')
}