Commit fb29acbe by 姜雷

修改主入口以及打包命令

parent 1ce6ca9e
......@@ -5,18 +5,17 @@
"author": "kuangshu <252019869@qq.com>",
"private": true,
"scripts": {
"dev": "vue-cli-service serve --port 8891",
"dev:local": "vue-cli-service serve ./src/dev-local/develop.js --port 8899",
"start": "npm run dev:local",
"dev": "vue-cli-service serve --port 8899",
"start": "npm run dev",
"lint": "eslint --ext .js,.vue src",
"build": "vue-cli-service build --modern",
"build:dev": "cross-env npm run buildapp:dev && npm run buildlib:dev",
"build:dev": "cross-env npm run buildapp:dev",
"buildapp:dev": "vue-cli-service build --modern --mode dev",
"buildlib:dev": "vue-cli-service build --target lib --name manageShell ./src/lib/main.js --modern --mode dev",
"build:test": "cross-env npm run buildapp:test && npm run buildlib:test",
"build:test": "cross-env npm run buildapp:test",
"buildapp:test": "vue-cli-service build --modern --mode test",
"buildlib:test": "vue-cli-service build --target lib --name manageShell ./src/lib/main.js --modern --mode test",
"build:master": "cross-env npm run buildapp:master && npm run buildlib:master",
"build:master": "cross-env npm run buildapp:master",
"buildapp:master": "vue-cli-service build --modern --mode master",
"buildlib:master": "vue-cli-service build --target lib --name manageShell ./src/lib/main.js --modern --mode master",
"build:prod": "vue-cli-service build --modern",
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="<%= BASE_URL %>ic_logo.ico" />
<script src="<%= BASE_URL %>system.js"></script>
<script src="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
<script src="https://unpkg.com/vuex@3.1.0/dist/vuex.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.0.1/dist/vue-router.js"></script>
<title>多彩综合管理系统</title>
</head>
<body>
<noscript>
<strong>We're sorry but hello-world doesn't work properly without JavaScript
enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
<script src="https://webapi.amap.com/maps?v=1.4.12&key=dd6103c90f2f17310a8711f2d330a0a6"></script>
<script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
<script src="https://unpkg.com/@antv/data-set"></script>
</html>
import { createSystem } from '../lib/main';
import asyncRouterMap from '../router/asyncRoutes';
import utils from '../lib/utils';
let constantRouter = [
{
path: '/asd',
name: 'asd',
component: {
template: '<div>asdasdasd</div>',
},
},
];
const routeFilter = (routes, allRoute) => {
if (allRoute && allRoute.length) {
let addRoute = utils.route.formatRouteLink(allRoute);
for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
routes = routes.concat(element.children);
} else if (
element.menuCode === process.env.VUE_APP_REGISTER_DASHBOARD_CODE
) {
routes.unshift(element);
}
}
}
return {
allRoute,
routes,
};
};
createSystem({
basePath: process.env.VUE_APP_BASE_URL,
routers: asyncRouterMap,
constantRouter: constantRouter,
whiteList: '/asd',
routeFilter: routeFilter,
});
// const script = document.createElement('script');
// script.text = `
// `;
// document.body.appendChild(script);
import CreatSystem from './lib/main';
import { createSystem } from './lib/main';
import asyncRouterMap from './router/asyncRoutes';
window.manageShell = { default: CreatSystem };
window.allAasyncRouterMap = [...asyncRouterMap];
import utils from './lib/utils';
const routeFilter = (routes, allRoute) => {
if (allRoute && allRoute.length) {
let addRoute = System.utils.route.formatRouteLink(allRoute);
let addRoute = utils.route.formatRouteLink(allRoute);
for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
......@@ -23,33 +21,8 @@ const routeFilter = (routes, allRoute) => {
routes,
};
};
const script = document.createElement('script');
script.text = `
manageShell.default.createSystem({
basePath: '${process.env.VUE_APP_BASE_URL}',
routers: allAasyncRouterMap,
routeFilter: function(routes, allRoute) {
if (allRoute && allRoute.length) {
let addRoute = manageShell.default.utils.route.formatRouteLink(
allRoute
);
for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
routes = routes.concat(element.children);
} else if (
element.menuCode === ${process.env.VUE_APP_REGISTER_DASHBOARD_CODE}
) {
routes.unshift(element);
}
}
}
return {
allRoute,
routes,
};
},
});
`;
document.body.appendChild(script);
createSystem({
basePath: process.env.VUE_APP_BASE_URL,
routers: asyncRouterMap,
routeFilter: routeFilter,
});
const Path = require('path');
let isLib = (() => {
let index = process.argv.findIndex(value => value === '--target');
if (index > -1) {
return process.argv[index + 1] && process.argv[index + 1] === 'lib';
} else {
return false;
}
})();
let isLocal = (() => {
return /develop/.test(process.argv[3]);
})();
module.exports = {
publicPath: process.env.VUE_APP_BASE_URL,
outputDir: isLib ? Path.join('dist', 'lib') : 'dist',
configureWebpack: {
externals: [
{
......@@ -25,14 +11,4 @@ module.exports = {
},
],
},
chainWebpack: config => {
if (!isLib && isLocal) {
config.plugin('html').tap(args => {
if (process.env.NODE_ENV == 'development') {
args[0].template = Path.join('src', 'dev-local', 'develop.html');
}
return args;
});
}
},
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment