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