Skip to content

Commit

Permalink
fix: frontend app not target config
Browse files Browse the repository at this point in the history
  • Loading branch information
sky committed Sep 28, 2018
1 parent 0d35aae commit 92976b3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ exports.getWebpackBuilder = config => {
pkg: 'easywebpack'
}
};

const pkgFile = path.join(config.baseDir, 'package.json');
const pkg = require(pkgFile);
if (!config.framework) {
const pkgFile = path.join(config.baseDir, 'package.json');
const pkg = require(pkgFile);
if (pkg.dependencies['egg-view-vue-ssr'] || pkg.dependencies[m.vue.pkg] || pkg.devDependencies[m.vue.pkg]) {
if (pkg.dependencies[m.vue.pkg] || pkg.devDependencies[m.vue.pkg]) {
config.framework = 'vue';
} else if (pkg.dependencies['egg-view-react-ssr'] || pkg.dependencies[m.react.pkg] || pkg.devDependencies[m.react.pkg]) {
} else if (pkg.dependencies[m.react.pkg] || pkg.devDependencies[m.react.pkg]) {
config.framework = 'react';
} else if (config.template && (pkg.dependencies[m.html.pkg] || pkg.devDependencies[m.html.pkg])) {
config.framework = 'html';
Expand All @@ -42,6 +41,11 @@ exports.getWebpackBuilder = config => {
console.warn('webpack.config.js missing framework config');
}
}
if (!config.target) {
if (!pkg.dependencies['egg-view-vue-ssr'] && !pkg.dependencies['egg-view-react-ssr']){
config.target = 'web';
}
}
const build = m[config.framework];

let builder = utils.getInstallPackage(build.pkg, config.baseDir);
Expand Down

0 comments on commit 92976b3

Please # to comment.