{"id":16822500,"url":"https://github.com/strml/webpack-3-scope-hoisting-bug","last_synced_at":"2025-07-25T20:37:18.522Z","repository":{"id":65991187,"uuid":"95127284","full_name":"STRML/webpack-3-scope-hoisting-bug","owner":"STRML","description":"A reproduction of a Webpack3 Hoisting Bug, #5138","archived":false,"fork":false,"pushed_at":"2017-06-22T15:00:31.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-20T07:00:43.972Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/webpack/webpack/issues/5138","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/STRML.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-22T14:59:48.000Z","updated_at":"2017-06-22T15:02:15.000Z","dependencies_parsed_at":"2023-02-28T11:16:48.899Z","dependency_job_id":null,"html_url":"https://github.com/STRML/webpack-3-scope-hoisting-bug","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"af3057fb7ee695eeb2eff38aa567bf4b05b30f57"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/STRML/webpack-3-scope-hoisting-bug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STRML%2Fwebpack-3-scope-hoisting-bug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STRML%2Fwebpack-3-scope-hoisting-bug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STRML%2Fwebpack-3-scope-hoisting-bug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STRML%2Fwebpack-3-scope-hoisting-bug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/STRML","download_url":"https://codeload.github.com/STRML/webpack-3-scope-hoisting-bug/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STRML%2Fwebpack-3-scope-hoisting-bug/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267057908,"owners_count":24028924,"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","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-13T11:04:30.671Z","updated_at":"2025-07-25T20:37:18.479Z","avatar_url":"https://github.com/STRML.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webpack 3 Strict 'This' Module Concatenation Bug\n\nWhen using `module.strictThisContextOnImports` (required to work around [#5135](https://github.com/webpack/webpack/issues/5135) and others),\nimported `const`s from other modules are not properly referenced when calling a function on a namespace\nreferred to by an `import *`.\n\nThis bug only seems to manifest under these conditions:\n\n* `module.strictThisContextOnImports: true`,\n* A constant must be imported from another file,\n* That constant must be used in a function referenced on an `import * from`.\n\nThe output:\n\n\n```js\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n\n// CONCATENATED MODULE: ./constants.js\nconst constants_FOO = 'BAR';\n\n// CONCATENATED MODULE: ./functions.js\nfunction print(str) {\n  console.log(str);\n}\n\n// CONCATENATED MODULE: ./index.js\nfunction init() {\n  console.log(constants_FOO)\n  print(FOO);\n}\n```\n\nNotice that the `print` call is referring to `FOO`, not `constants_FOO`.\n\nIf we are using the `CommonsChunkPlugin` or split in such a way that `constants` becomes another module,\nthe `console.log()` line will properly use the imported constant, but the `print()` will not, e.g.:\n\n```js\nconsole.log(__WEBPACK_IMPORTED_MODULE_10_constants__[\"f\" /* FOO */]);\nprint(FOO);\n```\n\n`FOO` is of course not defined in this instance and this will fail at runtime.\n\n\n### To Reproduce\n\n```bash\nyarn\nnpm run build\ncat index.build.js\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrml%2Fwebpack-3-scope-hoisting-bug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrml%2Fwebpack-3-scope-hoisting-bug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrml%2Fwebpack-3-scope-hoisting-bug/lists"}