|
|
@@ -1,9 +1,11 @@
|
|
|
var projectname = process.argv[3];
|
|
|
var glob = require("glob");
|
|
|
var publicPath = ''
|
|
|
+console.log(process.env.NODE_ENV)
|
|
|
|
|
|
function getEntry() {
|
|
|
var entries = {};
|
|
|
+
|
|
|
if (process.env.NODE_ENV == "production") {
|
|
|
entries = {
|
|
|
index: {
|
|
|
@@ -25,13 +27,10 @@ function getEntry() {
|
|
|
var fileList = filepath.split("/");
|
|
|
var fileName = fileList[fileList.length - 2];
|
|
|
publicPath = '/' + fileName + '/'
|
|
|
- console.log(fileName, 'fileName')
|
|
|
entries[fileName] = {
|
|
|
entry: `src/views/${fileName}/main.js`,
|
|
|
// 模板来源
|
|
|
- template: `publ
|
|
|
- ic/index.html`,
|
|
|
- title: fileName == 'zhulao' ? '邹平养老' : '邹平未保客户端',
|
|
|
+ template: `public/index.html`,
|
|
|
// 在 dist/index.html 的输出
|
|
|
filename: `${fileName}.html`,
|
|
|
};
|
|
|
@@ -45,7 +44,7 @@ function resolve(dir) {
|
|
|
return path.join(__dirname, dir)
|
|
|
}
|
|
|
const port = process.env.port || process.env.npm_config_port || 12004 // dev port
|
|
|
-// const name = defaultSettings.title || 'vue Admin Template' // page title
|
|
|
+const name = 'vue Admin Template' // page title
|
|
|
var pages = getEntry();
|
|
|
console.log(publicPath)
|
|
|
module.exports = {
|
|
|
@@ -124,5 +123,15 @@ module.exports = {
|
|
|
}
|
|
|
}
|
|
|
// after: require('./mock/mock-server.js')
|
|
|
- }
|
|
|
+ },
|
|
|
+ configureWebpack: {
|
|
|
+ // provide the app's title in webpack's name field, so that
|
|
|
+ // it can be accessed in index.html to inject the correct title.
|
|
|
+ name: name,
|
|
|
+ resolve: {
|
|
|
+ alias: {
|
|
|
+ '@': resolve('src')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
};
|