Title: Runtime externals don't work in webpack · Issue #238 · unjs/unplugin · GitHub
Open Graph Title: Runtime externals don't work in webpack · Issue #238 · unjs/unplugin
X Title: Runtime externals don't work in webpack · Issue #238 · unjs/unplugin
Description: Environment unplugin 1.0.1 Reproduction https://github.com/ef4/unplugin-bug-repro (edited to add) Describe the bug This code: unplugin/src/webpack/index.ts Lines 126 to 128 in c29ef3e // If the resolved module does not exist, // we treat...
Open Graph Description: Environment unplugin 1.0.1 Reproduction https://github.com/ef4/unplugin-bug-repro (edited to add) Describe the bug This code: unplugin/src/webpack/index.ts Lines 126 to 128 in c29ef3e // If the res...
X Description: Environment unplugin 1.0.1 Reproduction https://github.com/ef4/unplugin-bug-repro (edited to add) Describe the bug This code: unplugin/src/webpack/index.ts Lines 126 to 128 in c29ef3e // If the res...
Opengraph URL: https://github.com/unjs/unplugin/issues/238
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Runtime externals don't work in webpack","articleBody":"### Environment\r\n\r\nunplugin 1.0.1\r\n\r\n### Reproduction\r\n\r\nhttps://github.com/ef4/unplugin-bug-repro (edited to add)\r\n\r\n### Describe the bug\r\n\r\nThis code:\r\n\r\nhttps://github.com/unjs/unplugin/blob/c29ef3e6d39bf65da63fd43269f030c64587ed4b/src/webpack/index.ts#L126-L128\r\n\r\ntries to locate external modules on the filesystem at build time, and if they're not found it introduces empty virtual modules for them.\r\n\r\nBut this means we cannot actually use `externals` the way that both webpack and rollup typically understand `externals`: they're supposed to get resolved *at runtime*. Whether they existed during build time is not supposed to matter.\r\n\r\n### Expected behavior:\r\n\r\n - If my `resolveId` hook returns `false`, the original import statement should be left alone in the output, so that it will be resolved at runtime.\r\n - If my `resolveId` hook returns `{ external: true, id: 'xyz' }`, the original import statement gets replaced with an import statement for `'xyz'`, and that redirected import statement will get resolved at runtime.\r\n\r\n### Actual behavior:\r\n\r\n - In both the above cases, the original import is replaced with an empty virtual module, and no runtime resolution ever happens.\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_","author":{"url":"https://github.com/ef4","@type":"Person","name":"ef4"},"datePublished":"2022-12-19T03:21:59Z","url":"https://github.com/unjs/unplugin/issues/238"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e19b752c-6c1e-0185-f77d-74c7b4f6f9ab |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E04E:1A7566:DBB5EB:1269B5B:6B0054EF |
| html-safe-nonce | 91b4cfde432b15fd93c73cc0b97d36956babf1c22f46a3820c022f531bbf8ea6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDRFOjFBNzU2NjpEQkI1RUI6MTI2OUI1Qjo2QjAwNTRFRiIsInZpc2l0b3JfaWQiOiIyNDI5OTE0ODQwODQ0NzUyMTExIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5c32b08faa45e3505de8e2addaa65ba932bdfbe67734cac9e5cb37ae9bfa6f1f |
| hovercard-subject-tag | issue:1502229125 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/unjs/unplugin/238/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0fb2698f51a2d39543320aab79c179007704219c6f148c9c97f6efe8ffd4a922/unjs/unplugin/issues/238 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0fb2698f51a2d39543320aab79c179007704219c6f148c9c97f6efe8ffd4a922/unjs/unplugin/issues/238 |
| og:image:alt | Environment unplugin 1.0.1 Reproduction https://github.com/ef4/unplugin-bug-repro (edited to add) Describe the bug This code: unplugin/src/webpack/index.ts Lines 126 to 128 in c29ef3e // If the res... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ef4 |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| turbo-cache-control | no-preview |
| go-import | github.com/unjs/unplugin git https://github.com/unjs/unplugin.git |
| octolytics-dimension-user_id | 80154025 |
| octolytics-dimension-user_login | unjs |
| octolytics-dimension-repository_id | 385261169 |
| octolytics-dimension-repository_nwo | unjs/unplugin |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 385261169 |
| octolytics-dimension-repository_network_root_nwo | unjs/unplugin |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width