重新编译文件管理

This commit is contained in:
Suwings 2019-09-12 21:46:43 +08:00
parent 9b3f7b6f01
commit 81d7e536bf
20 changed files with 74 additions and 6383 deletions

20
package-lock.json generated
View File

@ -33,6 +33,13 @@
"qs": "6.5.1",
"raw-body": "2.3.2",
"type-is": "~1.6.15"
},
"dependencies": {
"iconv-lite": {
"version": "0.4.19",
"resolved": "https://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.19.tgz",
"integrity": "sha1-90aPYBNfXl2tM5nAqBvpoWA6CCs="
}
}
},
"bytes": {
@ -130,7 +137,7 @@
},
"dateformat": {
"version": "1.0.7-1.2.3",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.7-1.2.3.tgz",
"resolved": "https://registry.npm.taobao.org/dateformat/download/dateformat-1.0.7-1.2.3.tgz",
"integrity": "sha1-67Vhu3IU7leo3CaHrasdVV3pQZw="
},
"debug": {
@ -323,7 +330,7 @@
},
"ftpd": {
"version": "git+https://github.com/sstur/nodeftpd.git#0d299f78af7f0006a9d5a084614bd8b56a369d1b",
"from": "ftpd@git+https://github.com/sstur/nodeftpd.git#0d299f78af7f0006a9d5a084614bd8b56a369d1b",
"from": "git+https://github.com/sstur/nodeftpd.git",
"requires": {
"dateformat": "1.0.7-1.2.3",
"stat-mode": "^0.2.1"
@ -539,6 +546,13 @@
"http-errors": "1.6.2",
"iconv-lite": "0.4.19",
"unpipe": "1.0.0"
},
"dependencies": {
"iconv-lite": {
"version": "0.4.19",
"resolved": "https://registry.npm.taobao.org/iconv-lite/download/iconv-lite-0.4.19.tgz",
"integrity": "sha1-90aPYBNfXl2tM5nAqBvpoWA6CCs="
}
}
},
"safe-buffer": {
@ -601,7 +615,7 @@
},
"stat-mode": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/stat-mode/-/stat-mode-0.2.2.tgz",
"resolved": "https://registry.npm.taobao.org/stat-mode/download/stat-mode-0.2.2.tgz",
"integrity": "sha1-5sgLYjEj19gM8TLOU480YokHJQI="
},
"statuses": {

View File

@ -1,6 +0,0 @@
文件管理系统
---------
这是一个崭新的子项目,您更改代码之后需要将其进行编译。
具体使用请查看: https://github.com/Suwings/IndependentFileManager

View File

@ -0,0 +1,21 @@
//标准的URL定位器
//如果你的程序不在根目录,可以考虑更改这里,或者你有什么其他姿势。
//如果你需要反向代理加入SSL请更改此处
//某些 login 页面没有 MCSERVER 全局变量,在此实例化
if (window.MCSERVER == undefined) window.MCSERVER = {};
//Ws 默认协议
MCSERVER.WS_PROTOCOL = 'ws://';
//HTTP 默认协议
MCSERVER.HTTP_PROTOCOL = 'http://';
//URL定位器
MCSERVER.URL = function (url, protocol) {
var _protocol = protocol || MCSERVER.HTTP_PROTOCOL;
var hostName = window.location.host;
var openURL = hostName + '/' + url + '';
return _protocol + openURL;
};

View File

@ -1,161 +0,0 @@
<template lang="html">
<div class="m-files-panel">
<!--表头-->
<table class="m-table" width="100%">
<tr height="52px">
<th width="4%" style="">
<input type="checkbox" v-model="checkboxAll">
</th>
<th width="45%">文件名</th>
<th width="10%">类型</th>
<th width="15%">大小</th>
<th class="m-phone-none" width="26%">创建时间</th>
</tr>
<tr>
<td>
<input type="checkbox" aria-checked="false" value="on" disabled="disabled">
</td>
<td style="color: blue;cursor: pointer;">
<a class="m-item-file-a-dir" href="javascript:void(0);" v-on:click="cduplevel">上级目录</a>
</td>
<td>指令</td>
<td></td>
<td class="m-phone-none"></td>
</tr>
<tr v-for="item in fileList">
<td v-on:click="fileSelectedEvent(item)">
<input type="checkbox" v-model="item.checkbox">
</td>
<td>
<a v-if="!item.isFile" class="m-item-file-a-dir" href="javascript:void(0);" v-html="enContext(item.name)" v-on:click="cd(item)"></a>
<a v-else target="_black" class="m-item-file-a-file" :href="getDownloadURL(item)" v-html="enContext(item.name)" v-on:click="cd(item)"></a>
</td>
<td v-if="item.isFile">文件</td>
<td v-else>目录</td>
<td v-text="sizecomp(item,item.size)"></td>
<td class="m-phone-none" v-text="item.time"></td>
</tr>
</table>
</div>
</template>
<style lang="css">
.m-files-panel {
/*padding: 0 8px;*/
overflow: hidden;
}
.m-table th {
background-color: #ececec;
}
.m-table th,
.m-table td {
padding: 8px;
border-bottom: 1px solid #dcdcdc;
}
.m-table td {
padding: 4px 8px;
}
.m-table tr:hover {
background-color: #d4d4d4;
}
.m-item-file-a-dir {
color: black;
display: inline-block;
width: 100%;
}
.m-item-file-a-file {
color: rgb(100, 100, 100);
display: inline-block;
width: 100%;
}
</style>
<script>
import hubMoudle from "../module/hub";
import functionModule from "../module/function";
import tools from "../module/tools";
export default {
props: ["fileList", "commonHub"],
data() {
return {
checkboxAll: false,
selectedStack: []
};
},
methods: {
getDownloadURL(item) {
return window.MCSERVER.URL('fs/download/') + encodeURIComponent(item.name);
},
enContext(text) {
return tools.encodeContext(text);
},
sizecomp(item, size) {
//
let res = 0;
if (!item.isFile) return "";
if (size < 0) return "特殊";
if (size <= 1024) return size.toFixed(1) + " B";
if ((res = size / 1024) <= 1024) return res.toFixed(1) + " KB";
if ((res = size / 1024 / 1024) <= 1024) return res.toFixed(1) + " MB";
if ((res = size / 1024 / 1024 / 1024) <= 1024)
return res.toFixed(1) + " GB";
},
//
fileSelectedEvent(item) {
if (item) item.checkbox = !item.checkbox;
this.reloadStack();
},
//
reloadStack() {
let selectedStack = [];
for (let v of this.fileList) {
if (v.checkbox) selectedStack.push(v);
}
this.commonHub.set("CompFiles", selectedStack);
},
resetStack(vool) {
for (let v of this.fileList) v.checkbox = vool;
this.reloadStack();
},
cd(item) {
let that = this;
if (item.isFile) {
//
} else {
//
this.commonHub.set("CompFiles", []);
this.checkboxAll = false;
functionModule.ls(item.name).then(data => {
that.fileList = data;
});
}
},
cduplevel() {
this.checkboxAll = false;
let that = this;
functionModule.ls("../").then(data => {
that.fileList = data;
});
this.commonHub.set("CompFiles", []);
}
},
watch: {
checkboxAll() {
for (let v of this.fileList) {
v.checkbox = this.checkboxAll;
}
this.reloadStack();
return this.checkboxAll;
}
}
};
</script>

View File

@ -1,215 +0,0 @@
<template lang="html">
<div class="letsgo">
<div class="m-lmuem-items">
<!-- 菜单列表项 数据源在下面 -->
<div v-for="item in items" v-on:click="filesOperate(item)">
<span v-if="item.title" class="m-lmuem-items-title">
{{ item.name }}
</span>
<span v-else>
<span v-bind:class="item.class" style="margin-right: 5px;"></span> {{ item.name }}
</span>
</div>
</div>
</div>
<!-- 文件上传的表单 -->
<form id="m-upload-form" style="display:none;" method="post" enctype="multipart/form-data" action="/fs/upload">
<input type="file" name="upload_file" id="m-upload-file" v-on:change="formSub" />
</form>
</template>
<style lang="css">
/* .m-lmuem-items {} */
.m-lmuem-items div {
width: 100%;
color: #777;
text-align: left;
padding: 6px 0px 6px 14px;
margin: 0;
border-bottom: 1px solid #dcdcdc;
cursor: pointer;
}
.m-lmuem-items div:hover {
background-color: #fbfbfb;
}
.m-lmuem-items-title {
font-size: 16px;
color: black;
padding-top: 3px;
padding-bottom: 3px;
display: block;
}
</style>
<script>
// import ajaxMoudule from "../module/ajax";
import functionMudule from "../module/function";
import tools from "../module/tools";
export default {
props: ["filesHub"],
methods: {
formSub(e) {
this.allowUpload = false;
let file = $("#m-upload-file")[0].files[0];
functionMudule.upload(file, (status) => {
this.items[2].name = "正在上传.." + status + "%";
this.items[2].class = this.items[2].class + " color-green";
console.log(this.items[2].name);
}).then((status) => {
this.items[2].name = "上传完毕!"
location.reload();
}, (XML, textStatus, errorThrown) => {
tools.popWindow("错误,文件上传失败!\n" + errorThrown);
});
},
filesOperate(item) {
//
let stack = this.getFileStack();
console.log(stack);
if (item.title) return;
switch (item.name) {
case "刷新":
location.reload();
break;
case "上传文件":
if (this.allowUpload)
$("#m-upload-file").click();
else
tools.popWindow("当前再禁止上传文件,请点击刷新即可再次上传。");
break;
case "复制":
functionMudule.copy(this.getFileStack());
tools.popWindow("已复制到临时区域,使用粘贴即可复制到当前目录");
break;
case "剪贴":
functionMudule.cponce(this.getFileStack());
tools.popWindow("已复制到临时区域,使用粘贴即可移动到当前目录");
break;
case "粘贴":
//BUG Note then
functionMudule.paste().then(() => location.reload());
break;
case "删除":
let filestack = this.getFileStack(); //BUG Note:this
tools.confirm("您确定要删除这(些)文件吗?", () => {
functionMudule.remove(filestack).then(() => location.reload());
});
break;
case "重命名":
if (this.getFileStack().length != 1) {
tools.popWindow("非法操作,不能同时重命名多个文件或未选择文件");
break;
}
let stack = this.getFileStack();
tools.prompt("重命名", (newName) => {
functionMudule.rename(stack, newName).then(() => location.reload());
});
break;
case "新建目录":
tools.prompt("新的目录名", (newDirName) => {
functionMudule.mkdir(newDirName).then(() => location.reload());
});
break;
case "退出":
window.location.href = "/fs_auth/logout";
break;
case "使用提示":
functionMudule.userInfo();
break;
default:
console.error("--------------- 选择操作未执行 ---------------");
break;
}
// this.filesHub.set("CompFiles", []); //Line: bug
},
getFileStack() {
let stack = this.filesHub.get("CompFiles", []);
return stack;
}
},
data() {
let that = this;
return {
allowUpload: true,
items: [{
//
//
name: "基本功能", //
class: "", // Class
api: "", //使 API
title: true //
},
{
name: "刷新",
class: "glyphicon glyphicon-refresh",
api: ""
},
{
name: "上传文件", //
class: "glyphicon glyphicon-open",
api: "",
upload: true
},
{
name: "文件操作",
class: "",
api: "",
title: true
},
{
name: "新建目录",
class: "glyphicon glyphicon-plus",
api: ""
},
{
name: "重命名",
class: "glyphicon glyphicon-credit-card",
api: ""
},
{
name: "复制",
class: "glyphicon glyphicon-duplicate",
api: ""
},
{
name: "剪贴",
class: "glyphicon glyphicon-scissors",
api: ""
},
{
name: "粘贴",
class: "glyphicon glyphicon-paste",
api: ""
},
{
name: "删除",
class: "glyphicon glyphicon-trash",
api: ""
},
{
name: "用户操作",
class: "",
api: "",
title: true
},
{
name: "使用提示",
class: "glyphicon glyphicon-asterisk",
api: ""
},
{
name: "退出",
class: "glyphicon glyphicon-log-out",
api: ""
}
]
};
}
};
</script>

View File

@ -1,37 +0,0 @@
import Vue from 'vue';
import componentLmuem from './components/lmuem';
import componentFiles from './components/files';
import hubModule from "./module/hub";
const filesHub = hubModule.Hub;
new Vue({
el: "#vm-leftm-items",
data: {
filesHub: filesHub,
},
components: {
componentLmuem,
}
});
import funcModule from "./module/function";
const vm_files_items = new Vue({
el: "#vm-files-items",
components: {
componentFiles,
},
data: {
commonHub: filesHub,
filesCollect: []
}
});
funcModule.ls().then(function name(data) {
vm_files_items.$data.filesCollect = data;
});

View File

@ -1,58 +0,0 @@
const DEBUG = true;
class Ajax {
constructor(parameter) {
this.parameter = parameter;
this.parameter["json"] = parameter["json"] || true;
}
success(data) {
if (DEBUG) console.log("Ajax success\n", data);
try {
if (typeof data != "object")
if (this.parameter["json"]) data = JSON.parse(data);
} catch (e) {
console.error('WANG: Ajax BackData is not JSON', e);
} finally {
if (this.parameter['success']) this.parameter['success'](data.response || data, data);
}
}
error(XML, textStatus, errorThrown) {
if (DEBUG) console.error("Ajax error!!!\n", XML);
if (this.parameter['error']) this.parameter['error'](XML, textStatus, errorThrown);
}
ajax() {
var that = this;
if (typeof this.parameter['data'] == "object")
this.parameter['data'] = JSON.stringify(this.parameter['data']);
if (DEBUG) console.log("发起 Ajax:", this.parameter['url'], "数据:" + this.parameter.data);
$.ajax({
type: this.parameter['type'] || "POST",
url: encodeURI(this.parameter['url']),
data: {
request: this.parameter['data']
}, //具体实例化
timeout: this.parameter['timeout'] || 8000,
success: function (data) {
that.success(data);
},
error: function (XML, textStatus, errorThrown) {
that.error(XML, textStatus, errorThrown);
},
cache: this.parameter['cache'] || false
});
}
reset(newParameters) {
for (let key in newParameters) {
this.parameter[key] = newParameters[key];
}
}
}
exports.Ajax = Ajax;

View File

@ -1,121 +0,0 @@
import ajaxMoudule from "./ajax";
import tools from "./tools";
const Ajax = ajaxMoudule.Ajax;
const BASE_DIR = "";
function promiseAjax(url, datas = "") {
return new Promise((resolve, reject) => {
new Ajax({
url: url,
data: datas,
success(res, obj) {
resolve(res);
},
error(XML, textStatus, errorThrown) {
reject(XML, textStatus, errorThrown);
}
}).ajax();
});
}
exports.ls = (path) => {
console.log("刷新");
return new Promise((resolve, reject) => {
promiseAjax(MCSERVER.URL("fs/ls"), path).then((data) => {
//排序
let res_dir = [];
let res_file = [];
for (let k in data) {
if (!data[k].isFile) {
res_dir.push(data[k]);
} else {
res_file.push(data[k]);
}
}
let newRes = res_dir.sort().concat(res_file.sort());
resolve(newRes);
}, (XML) => {
if (XML.status == 401 || XML.status == 403) {
tools.popWindow("非法 的访问操作,权限不足,请重新登陆!");
}
});
});
};
exports.mkdir = (newName) => {
console.log("新建目录");
return promiseAjax(MCSERVER.URL("fs/mkdir"), newName);
};
exports.copy = (fileStack) => {
console.log("复制");
return promiseAjax(MCSERVER.URL("fs/cp"), fileStack);
};
exports.paste = () => {
console.log("粘贴");
return promiseAjax(MCSERVER.URL("fs/patse"));
};
exports.remove = (fileStack) => {
console.log("删除");
return promiseAjax(MCSERVER.URL("fs/rm"), fileStack);
};
exports.cponce = (fileStack) => {
console.log("剪贴");
return promiseAjax(MCSERVER.URL("fs/ct"), fileStack);
};
exports.rename = (filesStack, newName) => {
console.log("重名名:", filesStack[0].name, "->", newName);
if (filesStack.length == 1) {
let oldName = filesStack[0].name;
return promiseAjax(MCSERVER.URL("fs/rename"), {
oldName: oldName,
newName: newName
});
} else {
tools.popWindow("非法操作,同时命名多个文件或未选择文件!");
}
};
exports.upload = (file, progress) => { //$("#m-upload-file")[0].files[0]
if (typeof FormData != "function") {
//兼容性
alert("很遗憾,您的浏览器不兼容异步文件上传。请使用现代浏览器!");
return null;
}
var oMyForm = new FormData();
oMyForm.append("time", new Date().toUTCString());
oMyForm.append("upload_file", file);
return new Promise((resolve, reject) => {
var oReq = new XMLHttpRequest();
oReq.open("POST", "/fs/upload", true);
oReq.onload = function (oEvent) {
if (oReq.status == 200) {
resolve("Done");
} else {
reject(oReq.status);
}
};
oReq.upload.addEventListener("progress", (evt) => {
var percentComplete = Math.round(evt.loaded * 100 / evt.total);
progress(percentComplete);
}, false);
oReq.send(oMyForm);
});
};
exports.userInfo = () => {
tools.popWindowHtml([
"<div style='text-align: left;'>1. 因单页应用缘故不可同时在同一浏览器内打开两个文件管理",
"2. 复制目录不可复制到目录本身内",
"3. 单击文件即可下载,单击目录即可进入目录",
"4. 如需编辑文件,请下载修改再上传,会自动覆盖重名文件</div>"
].join("<br />"), "使用须知", 20000);
}

View File

@ -1,41 +0,0 @@
class Hub {
constructor() {
this._eventSet = {};
this._objectSet = {};
}
listener(event, callback) {
let src = this._eventSet;
if (src.hasOwnProperty(event)) {
src[event].push(callback);
} else {
src[event] = [callback];
}
return this;
}
noify(event, args) {
let src = this._eventSet;
if (src.hasOwnProperty(event)) {
for (let i in src[event]) {
if (src[event][i] == null) delete src[event][i];
if (typeof src[event][i] != "function") delete src[event][i];
src[event][i].call(src[event][i], args);
}
}
}
set(name, value) {
this._objectSet[name] = value;
}
get(name, defValue = null) {
return this._objectSet[name] ? this._objectSet[name] : defValue;
}
}
const onlyHub = new Hub();
exports.HubClass = Hub;
exports.Hub = onlyHub;

View File

@ -1,79 +0,0 @@
//工具类
import swal from 'sweetalert2';
//弹出提示框
exports.popWindow = (data, title, timer) => {
console.log("弹出:", data);
swal({
title: title || "",
text: '' + data,
timer: timer || 5000
});
};
exports.popWindowHtml = (html, title, timer) => {
//可能的 XSS 攻击!
swal({
title: title || "",
type: 'info',
html: html,
width: 600
});
}
exports.confirm = (msg, callbackt, callbackf) => {
swal({
title: 'Are you sure?',
text: msg,
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(function (isConfirm) {
if (isConfirm.value) {
callbackt && callbackt();
} else {
callbackf && callbackf();
}
});
};
exports.prompt = (msg, callbackT, callbackF) => {
swal({
title: msg,
input: 'text',
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
showLoaderOnConfirm: true,
preConfirm: function () {
return new Promise(function (resolve) {
setTimeout(function () {
resolve();
}, 500);
});
},
allowOutsideClick: false
}).then((text) => {
if (text && text.value)
callbackT && callbackT(text.value);
else
callbackF && callbackF("");
});
};
exports.encodeContext = (text) => {
let tmp = new String(text);
tmp = tmp.replace(/ /g, "&nbsp;");
tmp = tmp.replace(/</g, "&lt;");
tmp = tmp.replace(/>/g, "&gt;");
// tmp = tmp.replace(/&/g, "&gt;");
// tmp = tmp.replace(/\'/g, "&#39;");
// tmp = tmp.replace(/\"/g, "&quit;");
// tmp = tmp.replace(/\n/igm, "<>");
return tmp;
};

View File

@ -0,0 +1 @@
.m-lmuem-items div{width:100%;color:#777;text-align:left;padding:6px 0 6px 14px;margin:0;border-bottom:1px solid #dcdcdc;cursor:pointer}.m-lmuem-items div:hover{background-color:#fbfbfb}.m-lmuem-items-title{font-size:16px;color:#000;padding-top:3px;padding-bottom:3px;display:block}.m-files-panel{overflow:hidden}.m-table th{background-color:#ececec}.m-table td,.m-table th{padding:8px;border-bottom:1px solid #dcdcdc}.m-table td{padding:4px 8px}.m-table tr:hover{background-color:#d4d4d4}.m-item-file-a-dir{color:#000;display:inline-block;width:100%}.m-item-file-a-file{color:#646464;display:inline-block;width:100%}

File diff suppressed because one or more lines are too long

View File

@ -1,53 +1,24 @@
<!DOCTYPE html>
<html lang="zh-CN">
<html lang=zh-CN>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="renderer" content="webkit" />
<meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no" />
<title>文件在线管理 | Mcserver Manager</title>
<link rel="stylesheet" href="./static/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="./static/main.css" />
<link href="./favicon.ico" rel="shortcut icon">
<meta charset=utf-8>
<meta http-equiv=X-UA-Compatible content="IE=Edge,chrome=1">
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta http-equiv=Content-Language content=zh-CN>
<meta name=renderer content=webkit>
<meta name=viewport content="initial-scale=1,maximum-scale=3,minimum-scale=1,user-scalable=no">
<title>文件在线管理 | Mcserver Manager</title>
<link rel=stylesheet href=static/bootstrap/css/bootstrap.min.css> <link rel=stylesheet href=./static/main.css> <link
href=./favicon.ico rel="shortcut icon">
<link href=css/app.3b06272a.css rel=preload as=style>
<link href=js/app.1f63600d.js rel=preload as=script>
<link href=js/chunk-vendors.40357f11.js rel=preload as=script>
<link href=css/app.3b06272a.css rel=stylesheet>
</head>
<body>
<div id="m-container" class=" container">
<div class="row">
<div class="m-header">
<p>
<span style="color: #ffff19;">Mcserver</span>
<span style="color: #ffffff;">Online File Manager</span>
</p>
</div>
<div class="container m-panel">
<div class="row">
<div class="col-md-3">
<div id="vm-leftm-items">
<component-lmuem :files-hub="filesHub"></component-lmuem>
</div>
</div>
<div class="col-md-9">
<div id="m-right-container">
<div id="vm-files-items">
<component-files :file-list="filesCollect" :common-hub="commonHub"></component-files>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--URL 处理函数-->
<script type="text/javascript" src="../common/URL.js"></script>
<script type="text/javascript" src="static/es6-promise.auto.min.js"></script>
<script type="text/javascript" src="static/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="dist/app.js"></script>
</body>
</html>
<div id=app></div>
<script type="text/javascript" src="../common/URL.js"></script>
<script src=static/es6-promise.auto.min.js> </script> <script src=static/jquery-3.2.1.min.js> </script> <script
src=js/chunk-vendors.40357f11.js> </script> <script src=js/app.1f63600d.js> </script> </body> </html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +0,0 @@
{
"name": "webpack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dist": "webpack"
},
"author": "",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.3.17",
"babel-loader": "^6.2.0",
"babel-plugin-transform-runtime": "^6.3.13",
"babel-preset-es2015": "^6.3.13",
"babel-runtime": "^5.8.34",
"css-loader": "^0.23.0",
"vue-hot-reload-api": "^1.2.2",
"vue-html-loader": "^1.0.0",
"vue-style-loader": "^1.0.0",
"vue-loader": "^7.2.0",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
"es6-promise": "^4.2.2",
"style-loader": "^0.19.1",
"sweetalert2": "^7.4.0",
"uglifyjs-webpack-plugin": "^1.1.6",
"vue": "^1.0.13"
}
}

View File

@ -1,40 +0,0 @@
// nodejs 中的path模块
const path = require('path');
const uglify = require('uglifyjs-webpack-plugin');
require('es6-promise').polyfill();
module.exports = {
// 入口文件path.resolve()方法可以结合我们给定的两个参数最后生成绝对路径最终指向的就是我们的index.js文件
entry: path.resolve(__dirname, './app/main.js'),
// 输出配置
output: {
// 输出路径是 myProject/output/static
path: path.resolve(__dirname, "./dist"),
publicPath: '/',
filename: 'app.js'
//chunkFilename: '[id].[chunkhash].js'
},
//也要加载
resolve: {
extensions: ['', '.js', '.vue']
},
devtool: 'source-map',
module: {
loaders: [
// 使用vue-loader 加载 .vue 结尾的文件
{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.js$/,
loader: 'babel?presets=es2015',
exclude: /node_modules/
}
]
},
plugins: [
new uglify()
]
}