Title: Webpack compilation fails: unplugin loader prevents html-webpack-plugin from processing HTML files · Issue #523 · unjs/unplugin · GitHub
Open Graph Title: Webpack compilation fails: unplugin loader prevents html-webpack-plugin from processing HTML files · Issue #523 · unjs/unplugin
X Title: Webpack compilation fails: unplugin loader prevents html-webpack-plugin from processing HTML files · Issue #523 · unjs/unplugin
Description: Environment platform: all unplugin version: 1.16.1 nodejs: 20.19.2 package manager: npm@10.8.2 Reproduction Repo: https://github.com/Loccko/unplugin-webpack-issues/tree/main To reproduce: Clone npm ci npm run build:webpack Describe the b...
Open Graph Description: Environment platform: all unplugin version: 1.16.1 nodejs: 20.19.2 package manager: npm@10.8.2 Reproduction Repo: https://github.com/Loccko/unplugin-webpack-issues/tree/main To reproduce: Clone npm...
X Description: Environment platform: all unplugin version: 1.16.1 nodejs: 20.19.2 package manager: npm@10.8.2 Reproduction Repo: https://github.com/Loccko/unplugin-webpack-issues/tree/main To reproduce: Clone npm...
Opengraph URL: https://github.com/unjs/unplugin/issues/523
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Webpack compilation fails: unplugin loader prevents html-webpack-plugin from processing HTML files","articleBody":"### Environment\n\n- **platform**: all\n- **unplugin version**: 1.16.1\n- **nodejs**: 20.19.2\n- **package manager**: npm@10.8.2\n\n\n### Reproduction\n\nRepo: https://github.com/Loccko/unplugin-webpack-issues/tree/main\nTo reproduce:\n1. Clone\n2. `npm ci`\n3. `npm run build:webpack`\n\n\n### Describe the bug\n\nWhen using `@intlify/unplugin-vue-i18n` together with `html-webpack-plugin` in webpack configuration, the compilation fails with the following error:\n\n```\nError: Child compilation failed:\n Module parse failed: Unexpected token (1:0)\n File was processed with these loaders:\n * ./node_modules/unplugin/dist/webpack/loaders/load.js\n * ./node_modules/html-webpack-plugin/lib/loader.js\n You may need an additional loader to handle the result of these loaders.\n > \u003c!DOCTYPE html>\n ...\n```\n\nThis error indicates that webpack doesn't know how to process the `.html` file.\nThe `html-webpack-plugin` was added to `webpack.config.js` specifically to handle `.html` files.\n\nDuring compilation, the loader provided by `html-webpack-plugin` (`html-webpack-plugin/lib/loader.js`) checks for the presence of other loaders that have processed the .html file before handling it itself.\n\nThis occurs in the following code block:\n\n```javascript\nif (allLoadersButThisOne.length > 0 && !force) {\n return source;\n}\n```\n\nOriginal code: https://github.com/jantimon/html-webpack-plugin/blob/v5.6.3/lib/loader.js#L16\n\nIf other loaders are present, `html-webpack-plugin` doesn't modify the `.html` file and simply returns its source as-is.\nWhen debugging at this point, you can observe the following:\n\n\n\nThis shows that unplugin has already invoked its loader for the .html file and not only failed to process it itself, but also prevented html-webpack-plugin from processing it.\n\nYou can find more information in the README.md of the provided repository.\n\n### Additional context\n\nThere is a similar issue reported for unplugin-vue-i18n:\nhttps://github.com/intlify/bundle-tools/issues/222\n\n### Logs\n\n```sh\n\n```","author":{"url":"https://github.com/Loccko","@type":"Person","name":"Loccko"},"datePublished":"2025-07-08T11:27:37Z","url":"https://github.com/unjs/unplugin/issues/523"}
| 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:d5a80096-ffcd-640f-d5ba-7cee16903a8d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8FB4:356FBF:2E7EED7:3F575C8:6B005D50 |
| html-safe-nonce | d7956a8db27bde346225f44190f0e9673049391a931a6d2422695a0171a63d81 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RkI0OjM1NkZCRjoyRTdFRUQ3OjNGNTc1Qzg6NkIwMDVENTAiLCJ2aXNpdG9yX2lkIjoiNjQ4MzM2MDU3ODAwOTA2MjczNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1d1383defcea8bb0e48d8baaa7916bbc7c123ca3f9cdc93be4193cf70d57eceb |
| hovercard-subject-tag | issue:3212152160 |
| 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/523/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5a54151dbccd7e7195976ccd9e5cdf6eecf0b143beb6e82161e7e10f54c84a9f/unjs/unplugin/issues/523 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5a54151dbccd7e7195976ccd9e5cdf6eecf0b143beb6e82161e7e10f54c84a9f/unjs/unplugin/issues/523 |
| og:image:alt | Environment platform: all unplugin version: 1.16.1 nodejs: 20.19.2 package manager: npm@10.8.2 Reproduction Repo: https://github.com/Loccko/unplugin-webpack-issues/tree/main To reproduce: Clone npm... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Loccko |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width