2016-08-19 3 views
0

내 코드 비어 :수출은 browserify

SRC /하는 index.js

const myObject = { 
    name : "Object", 
    fun : function() { 
     console.log('Do some simple stuff'); 
    }, 
    data: "some data" 

}; 

export default myObject; 

와 browserify와 결과는 단순히 다음 사용

main.js에서
(function e(t,n,r){function s(o,u) ... 
"use strict"; 

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

function _classCallCheck(instance, Constructor) ..... 


var myObject = { 
    name: "Object", 
    fun: function fun() { 
     console.log('Do some simple stuff'); 
    }, 
    data: "some data" 

}; 

var X = function X() { 
    _classCallCheck(this, X); 
}; 

exports.default = myObject; 

//export default exposed; 
},{}]},{},[1]); 

, 모듈로 브 라우저 된 :

var x = require('./index'); 
console.log(x); // <--- empty object 

--standalone -s Generate a UMD bundle for the supplied export name. 
        This bundle works with other module systems and sets the name 
        given as a window global if no module system is found. 

이것은 (무엇보다도) CommonJS 모듈로 가져올 수 번들을 만드는 : 내가 놓친 바보 같은 :(

답변

2

나는 다음과 같은 옵션을 찾고 생각이 있어야합니다. 자세한 내용은 documentation에서 확인할 수 있습니다.