Related: #153
- (Note the empty dependency array, the code works if it is omitted)
define("test", [], function() {
return 1234;
});
define(["require", "test"], function(require, test) {
test.should.be.eql(1234);
require("test").should.be.eql(1234)
return "exported"
});
currently compiles to:
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_LOCAL_MODULE_0__;!(__WEBPACK_LOCAL_MODULE_0__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
return 1234;
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)));
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, __WEBPACK_LOCAL_MODULE_0__], __WEBPACK_AMD_DEFINE_RESULT__ = (function(require, test) {
test.should.be.eql(1234);
require("test").should.be.eql(1234)
return "exported"
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
-
I am quite sure that currently, doing require("test") as above does not work, even in your original example?
-
(Not sure if you intended to support this but I am reporting anyway)
define("dep", function(){
return 5678;
});
define("test", ["dep"], function() {
return 1234;
});
define(["require", "test"], function(require, test) {
test.should.be.eql(1234);
require("test").should.be.eql(1234)
return "exported"
});
currently compiles to:
var __WEBPACK_LOCAL_MODULE_0__;var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_LOCAL_MODULE_1__;!(__WEBPACK_LOCAL_MODULE_0__ = (function(){
return 5678;
}.call(exports, __webpack_require__, exports, module)));
!(__WEBPACK_LOCAL_MODULE_1__ = [__WEBPACK_LOCAL_MODULE_0__], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
return 1234;
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)));
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, __WEBPACK_LOCAL_MODULE_1__], __WEBPACK_AMD_DEFINE_RESULT__ = (function(require, test) {
test.should.be.eql(1234);
require("test").should.be.eql(1234)
return "exported"
}.apply(null, __WEBPACK_AMD_DEFINE_ARRAY__)), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
Related: #153
currently compiles to:
I am quite sure that currently, doing
require("test")as above does not work, even in your original example?(Not sure if you intended to support this but I am reporting anyway)
currently compiles to: