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
- Try to open images/font from
dist folder
Describe the bug
When using @intlify/unplugin-vue-i18n, unplugin corrupts all binary files (e.g., .jpg, .png, .svg) in the project, which then cannot be used in Vue components.
The root cause is unplugin/dist/webpack/loaders/load.js, which during execution calls the loader from @intlify/unplugin-vue-i18n. This loader does nothing with the source of these files (since the loader's condition check doesn't match). Subsequently, unplugin/dist/webpack/loaders/load checks the result of the unplugin-vue-i18n loader execution, which is undefined, and unplugin/dist/webpack/loaders/load calls the callback with the original input source.

Original code: https://github.com/unjs/unplugin/blob/v1.16.1/src/webpack/loaders/load.ts
Since unplugin/dist/webpack/loaders/load.js lacks the raw = true variable, webpack treats the source as regular text content and attempts to process it as text rather than binary data.
Info: https://webpack.js.org/api/loaders/#raw-loader
This results in corruption of all binary files, leading to broken image and font files that cannot be used.
Note: This issue appears to be relevant for both unplugin@1.x.x and unplugin@2.x.x, as both major versions lack this variable.
Additional context
No response
Logs
Environment
Reproduction
Repo: https://github.com/Loccko/unplugin-webpack-issues/tree/main
To reproduce:
npm cinpm run build:webpackdistfolderDescribe the bug
When using
@intlify/unplugin-vue-i18n, unplugin corrupts all binary files (e.g., .jpg, .png, .svg) in the project, which then cannot be used in Vue components.The root cause is
unplugin/dist/webpack/loaders/load.js, which during execution calls the loader from@intlify/unplugin-vue-i18n. This loader does nothing with the source of these files (since the loader's condition check doesn't match). Subsequently, unplugin/dist/webpack/loaders/load checks the result of the unplugin-vue-i18n loader execution, which is undefined, and unplugin/dist/webpack/loaders/load calls the callback with the original input source.Original code: https://github.com/unjs/unplugin/blob/v1.16.1/src/webpack/loaders/load.ts
Since
unplugin/dist/webpack/loaders/load.jslacks theraw = truevariable, webpack treats the source as regular text content and attempts to process it as text rather than binary data.Info: https://webpack.js.org/api/loaders/#raw-loader
This results in corruption of all binary files, leading to broken image and font files that cannot be used.
Note: This issue appears to be relevant for both unplugin@1.x.x and unplugin@2.x.x, as both major versions lack this variable.
Additional context
No response
Logs