[英]Can not bundle two files with webpack
I have the following webpack configuration file, where I'm trying to make two bundle files for two separate projects: 我有以下webpack配置文件,在这里我试图为两个单独的项目制作两个捆绑文件:
var webpack = require('webpack');
var path = require('path');
var INDEX_BUILD_DIR = path.resolve(__dirname, 'src/client/app/public');
var INDEX_APP_DIR = path.resolve(__dirname, 'src/client/app/');
var RESULTS_BUILD_DIR = path.resolve(__dirname, 'src/client/results/public');
var RESULTS_APP_DIR = path.resolve(__dirname, 'src/client/results/');
var config = {
entry: {
INDEX_BUILD_DIR: INDEX_APP_DIR,
RESULTS_BUILD_DIR: RESULTS_APP_DIR
},
output: {
path: './',
filename: '[name].js'
},
module : {
loaders : [
{
test : /\.jsx?/,
include : [INDEX_APP_DIR, RESULTS_APP_DIR],
loader : 'babel'
}
]
}
};
module.exports = config;
I made this structure after looking here: 在查看以下内容后,我制作了以下结构:
https://github.com/webpack/webpack/issues/1189 https://github.com/webpack/webpack/issues/1189
However, I am getting this issue: 但是,我得到这个问题:
ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' path/to/project/src/client/app in /path/to/project
I can't understand where the issue originates from. 我不明白问题的根源。
Also, only one file is created named "RESULTS_BUILD_DIR.js" which means that a variable is interpreted literally. 同样,仅创建一个名为“ RESULTS_BUILD_DIR.js”的文件,这意味着将按字面意义解释变量。
What causes these problems? 是什么原因导致这些问题?
There are 2 things: 有两件事:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.