{"id":19560706,"url":"https://github.com/zoubin/dedupe-with-factor-bundle","last_synced_at":"2025-10-16T19:01:52.864Z","repository":{"id":36223548,"uuid":"40527844","full_name":"zoubin/dedupe-with-factor-bundle","owner":"zoubin","description":"Bug example for using factor-bundle when dedupe happens","archived":false,"fork":false,"pushed_at":"2015-08-11T07:39:09.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-08T22:44:13.356Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zoubin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-11T07:26:12.000Z","updated_at":"2016-04-14T14:55:49.000Z","dependencies_parsed_at":"2022-09-24T22:10:30.160Z","dependency_job_id":null,"html_url":"https://github.com/zoubin/dedupe-with-factor-bundle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fdedupe-with-factor-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fdedupe-with-factor-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fdedupe-with-factor-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fdedupe-with-factor-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoubin","download_url":"https://codeload.github.com/zoubin/dedupe-with-factor-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240822615,"owners_count":19863302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T05:08:31.819Z","updated_at":"2025-10-16T19:01:52.792Z","avatar_url":"https://github.com/zoubin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dedupe problem with factor-bundle\nBug example for using factor-bundle when dedupe happens\n\n## Versions\n\n* browserify: 11.0.1\n* factor-bundle: 2.5.0\n\n## Source and build directory\n\n```\n⌘ tree src/\nsrc/\n├── a.js\n├── b.js\n├── c.js\n└── dups\n    └── c.js\n\n```\n\n```\n⌘ tree build/\nbuild/\n├── a.js\n├── b.js\n└── common.js\n```\n\n### src/a.js\n\n```javascript\nrequire('./c');\nmodule.exports = 'a';\n\n```\n\n### src/b.js\n\n```javascript\nrequire('./dups/c');\nmodule.exports = 'b';\n\n```\n\n### src/c.js\n\n```javascript\nmodule.exports = 'c';\n\n```\n\n### build/a.js\n\n```javascript\nrequire=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"\u0026\u0026require;if(!u\u0026\u0026a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"\u0026\u0026require;for(var o=0;o\u003cr.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\nrequire('./c');\nmodule.exports = 'a';\n\n},{\"./c\":3}]},{},[1]);\n\n```\n\n### build/b.js\n\n```javascript\nrequire=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"\u0026\u0026require;if(!u\u0026\u0026a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"\u0026\u0026require;for(var o=0;o\u003cr.length;o++)s(r[o]);return s})({2:[function(require,module,exports){\nrequire('./dups/c');\nmodule.exports = 'b';\n\n},{\"./dups/c\":4}],4:[function(require,module,exports){\narguments[4][3][0].apply(exports,arguments)\n},{\"dup\":3}]},{},[2]);\n\n```\n\n### build/common.js\n\n```javascript\nrequire=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"\u0026\u0026require;if(!u\u0026\u0026a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"\u0026\u0026require;for(var o=0;o\u003cr.length;o++)s(r[o]);return s})({3:[function(require,module,exports){\nmodule.exports = 'c';\n\n},{}]},{},[]);\n\n```\n\n## index.html\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cmeta charset='utf-8'\u003e\n    \u003cscript src=\"build/common.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"build/a.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"build/b.js\"\u003e\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003eDedupe problem with factor-bundle\u003c/h1\u003e\n    \u003cul\u003e\n      \u003cli\u003ebrowserify: 11.0.1\u003c/li\u003e\n      \u003cli\u003efactor-bundle: 2.5.0\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Error message\n\n```\nUncaught TypeError: Cannot read property '0' of undefined\n```\n\n`c.js` is deduped into `common.js`, so `arguments[4][3]` in `b.js` will be `undefined`\n\nThis problem was discussed in [substack/factor-bundle#38](https://github.com/substack/factor-bundle/pull/38), [substack/factor-bundle#39](https://github.com/substack/factor-bundle/pull/39) and [substack/factor-bundle#40](https://github.com/substack/factor-bundle/pull/40).\n\nHowever, since [8.0.0](https://github.com/substack/node-browserify/commit/324991581baf2797794207efc42ab18957635182), the dedupe style has been changed from `require` to `arguments[4]`, and the problem reexists again.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Fdedupe-with-factor-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoubin%2Fdedupe-with-factor-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Fdedupe-with-factor-bundle/lists"}