所以这是我的目录结构:
这是我的webpack配置:
var fs = require('fs')
var path = require('path')
var autoprefixer = require('autoprefixer')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
module.exports = {
entry: {
index: 'src/index/main.js',
video: 'src/video/main.js'
},
output: {
path: path.resolve(__dirname, '../dist/'),
filename: '[name].[hash].js',
chunkFilename: '[id].[chunkhash].js'
},
module: {
loaders: ....
},
resolve: {
extensions: ['', '.js', '.less'],
alias: {
'src': path.resolve(__dirname, '../src')
}
},
resolveLoader: {
root: path.join(__dirname, 'node_modules')
},
plugins: [
....some other plugins....
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
mangle: false
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
chunks: ['index', 'video'],
minChunks: 2
}),
new HtmlWebpackPlugin({
filename: 'index.html',
chunks: ['common', 'index'],
template: 'src/index/index.html',
inject: false,
minify: false
}),
new HtmlWebpackPlugin({
filename: 'video.html',
chunks: ['common', 'video'],
template: 'src/video/index.html',
inject: false,
minify: false
})
]
};
我在webpacked项目之后,得到的结果如下:
我的问题是,是否可以保持我的目录结构与webpacking项目之前相同?我在哪里错过了?