Skip to content

Commit

Permalink
fix: 配置错误
Browse files Browse the repository at this point in the history
  • Loading branch information
徒言 committed Aug 26, 2018
1 parent c460ace commit 89186f2
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions template/build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ function resolve (dir) {
return path.join(__dirname, '..', dir)
}

function getEntry (rootSrc) {
var map = {};
glob.sync(rootSrc + '/pages/**/main.js')
.forEach(file => {
var key = relative(rootSrc, file).replace('.js', '');
map[key] = file;
})
return map;
}

module.exports = {
// 通过 src/pages.js 来配置要打包的页面,
entry: MpvueEntry.getEntry('src/pages.js'),
target: require('mpvue-webpack-target'),
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('../[name]/js/main.js'),
chunkFilename: utils.assetsPath('../[id]/js/main.js'),
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue': 'mpvue',
Expand Down Expand Up @@ -87,10 +90,6 @@ function getEntry (rootSrc) {
plugins: [
new MpvuePlugin(),
new MpvueEntry(),
new CopyWebpackPlugin([{
from: resolve('./src/main.json'),
to: 'app.json'
}]),
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
Expand Down

0 comments on commit 89186f2

Please sign in to comment.