webpack 2包中的无序/反向代码?

时间:2017-04-27 18:27:30

标签: javascript webpack migration webpack-2 babel

我尝试从webpack 1迁移到webpack 2。到目前为止,我已经能够编译最终的bundle.js,但是,当我看到它时,它看起来像是一切都搞砸了或逆转了。知道会发生什么事吗?

Webpack 1 bundle.js初始块(有很多意义,有自举和加载器):

webpackJsonp([0,18],{

/***/ 0:
/***/ function(module, exports, __webpack_require__) {

    __webpack_require__("./node_modules/webpack-dev-server/client/index.js?http:/localhost:8000");
    __webpack_require__("./node_modules/webpack/hot/dev-server.js");
    module.exports = __webpack_require__("./app/javascripts/loader.js");


/***/ },

/***/ 1:
/***/ function(module, exports, __webpack_require__) {

    var map = {
        "./application.js": "./app/javascripts/loaders/application.js",
        "./authentication.js": "./app/javascripts/loaders/authentication.js",
        "./bootstrap.js": "./app/javascripts/loaders/bootstrap.js"
    };
    function webpackContext(req) {
        return __webpack_require__(webpackContextResolve(req));
    };
    function webpackContextResolve(req) {
        return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
    };
    webpackContext.keys = function webpackContextKeys() {
        return Object.keys(map);
    };
    webpackContext.resolve = webpackContextResolve;
    module.exports = webpackContext;
    webpackContext.id = 1;

Webpack 2 bundle.js初始块(完全没有任何意义,以[14,18]开头,并随机附带#chat-messages'定义:

webpackJsonp([14,18],{

/***/ "./app/future/big-ear/actions/chat-messages.js":
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});

var _ActionTypes = __webpack_require__("./app/future/constants/ActionTypes.js");

var _backboneRedux = __webpack_require__("./node_modules/backbone-redux/lib/index.js");

var _chatMessage = __webpack_require__("./app/future/big-ear/serializers/chat-message.js");

var _chatMessage2 = _interopRequireDefault(_chatMessage);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var actions = (0, _backboneRedux.actionFabric)({ ADD: _ActionTypes.ADD_CHAT_MESSAGES, REMOVE: _ActionTypes.REMOVE_CHAT_MESSAGES, MERGE: _ActionTypes.MERGE_CHAT_MESSAGES, RESET: _ActionTypes.RESET_CHAT_MESSAGES }, _chatMessage2.default);

actions.resetForChannel = function (channel_id, store) {
  var messages_to_remove = store.getState().chat_messages.by_channel_id[channel_id] || [];

  return {
    type: _ActionTypes.REMOVE_CHAT_MESSAGES,
    entities: messages_to_remove
  };
};

exports.default = actions;
module.exports = exports['default'];

0 个答案:

没有答案