refactor: 前端分开构建
This commit is contained in:
parent
8635886cde
commit
c7cb74be3a
|
@ -55,12 +55,30 @@
|
|||
</execution>
|
||||
<!-- Build and minify static files -->
|
||||
<execution>
|
||||
<id>yarn build</id>
|
||||
<id>yarn build business</id>
|
||||
<goals>
|
||||
<goal>yarn</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>build</arguments>
|
||||
<arguments>build business</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>yarn build login</id>
|
||||
<goals>
|
||||
<goal>yarn</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>build login</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>yarn build document</id>
|
||||
<goals>
|
||||
<goal>yarn</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>build document</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Vue from 'vue';
|
||||
import {Button, Col, Form, FormItem, Input, Row, RadioGroup} from 'element-ui';
|
||||
import {Button, Col, Form, FormItem, Input, Row, RadioGroup, Radio} from 'element-ui';
|
||||
import 'element-ui/lib/theme-chalk/index.css';
|
||||
import Login from "./Login.vue";
|
||||
import Ajax from "../common/js/ajax";
|
||||
|
@ -18,6 +18,7 @@ Vue.use(FormItem);
|
|||
Vue.use(Input);
|
||||
Vue.use(Button);
|
||||
Vue.use(RadioGroup);
|
||||
Vue.use(Radio);
|
||||
Vue.use(Ajax);
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,41 @@
|
|||
const path = require('path')
|
||||
const path = require('path');
|
||||
|
||||
function resolve(dir) {
|
||||
return path.join(__dirname, dir)
|
||||
return path.join(__dirname, dir);
|
||||
}
|
||||
|
||||
let projectName = process.argv[3];
|
||||
|
||||
const projects = {
|
||||
business: {
|
||||
entry: "src/business/main.js",
|
||||
template: "src/business/index.html",
|
||||
filename: "index.html"
|
||||
},
|
||||
login: {
|
||||
entry: "src/login/login.js",
|
||||
template: "src/login/login.html",
|
||||
filename: "login.html"
|
||||
},
|
||||
document: {
|
||||
entry: "src/document/document.js",
|
||||
template: "src/document/document.html",
|
||||
filename: "document.html"
|
||||
}
|
||||
};
|
||||
|
||||
const getPage = function (projectName) {
|
||||
if (!projectName) {
|
||||
return projects;
|
||||
}
|
||||
return {
|
||||
[projectName]: projects[projectName]
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
let pages = getPage(projectName);
|
||||
|
||||
module.exports = {
|
||||
productionSourceMap: false,
|
||||
devServer: {
|
||||
|
@ -17,23 +49,7 @@ module.exports = {
|
|||
},
|
||||
}
|
||||
},
|
||||
pages: {
|
||||
business: {
|
||||
entry: "src/business/main.js",
|
||||
template: "src/business/index.html",
|
||||
filename: "index.html"
|
||||
},
|
||||
login: {
|
||||
entry: "src/login/login.js",
|
||||
template: "src/login/login.html",
|
||||
filename: "login.html"
|
||||
},
|
||||
document: {
|
||||
entry: "src/document/document.js",
|
||||
template: "src/document/document.html",
|
||||
filename: "document.html"
|
||||
}
|
||||
},
|
||||
pages: pages,
|
||||
configureWebpack: {
|
||||
devtool: 'source-map',
|
||||
resolve: {
|
||||
|
@ -43,6 +59,6 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
chainWebpack(config) {
|
||||
config.plugins.delete('prefetch')
|
||||
config.plugins.delete('prefetch');
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue