Skip to content

Commit 90e7f2e

Browse files
committed
Fixed a couple minor bugs
- `this` in a module's context is not the module function anymore; instead, it is just the global `this` context - `browser` field in package.json can be an Object; this is currently unsupported when bundling a browser module, but at least now it will be ignored when determining the entry point of a module. Only a string value is supported. Push to 2.1.2
1 parent 926be5a commit 90e7f2e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function __require(uid, parentUid) {
2525
/* Note: if this module requires itself, or if its depenedencies
2626
require it, they will only see an empty Object for now */
2727
// Now load the module
28-
__modules[uid](__modulesCache[uid], __modulesCache[uid].exports);
28+
__modules[uid].call(this, __modulesCache[uid], __modulesCache[uid].exports);
2929
__modulesCache[uid].loaded = true;
3030
}
3131
return __modulesCache[uid].exports;

lib/moduleConcatStream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class ModuleConcatStream extends Readable {
109109
option is set */
110110
if(opts.browser) {
111111
opts.packageFilter = (parsedPkgJson, pkgPath) => {
112-
if(parsedPkgJson.browser) {
112+
if(typeof parsedPkgJson.browser === "string") {
113113
parsedPkgJson.main = parsedPkgJson.browser;
114114
}
115115
return parsedPkgJson;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "module-concat",
3-
"version": "2.1.1",
3+
"version": "2.1.2",
44
"description": "Lightweight CommonJS module concatenation tool",
55
"main": "index.js",
66
"dependencies": {

0 commit comments

Comments
 (0)