我写了一个看起来像这样的ES6模块:
export default function({makeCurrentVerUrl, verUrl, fileServer, downloadTokenType, appId}) {
...
}
当由webpack编译时,它看起来像这样:
webpackJsonp([5,7],[
/* 0 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (_ref) {
var makeCurrentVerUrl = _ref.makeCurrentVerUrl;
var verUrl = _ref.verUrl;
var fileServer = _ref.fileServer;
var downloadTokenType = _ref.downloadTokenType;
var appId = _ref.appId;
...
};
/***/ }
]);
哪个好,但我不知道如何运行这个文件并调用我的默认函数。
我可以加入它,
<script src="/path/to/script.js"></script>
我相信它会自动运行它,但是如何从浏览器中调用我在其中定义的函数? 在我的浏览器中没有定义require
。