intlify / intlify/bundle-tools
Module parse failed: Unexpected token (1:0) when combined with html-webpack-plugin
- Dominant language
- TypeScript
- Stars
- 270
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Description
### Reporting a bug?
When using webpack with both html-webpack-plugin and @intlify/unplugin-vue-i18n, the compilation fails with:
```
Error: Child compilation failed:
Module parse failed: Unexpected token (1:0)
File was processed with these loaders:
* ./node_modules/unplugin/dist/webpack/loaders/load.js
* ./node_modules/html-webpack-plugin/lib/loader.js
You may need an additional loader to handle the result of these loaders.
>
|
|
... further lines omitted ...
```
The @intlify/unplugin-vue-i18n for some reason ends up as an additional loader for index.html, even though it is not being configured so. Omitting either plugin makes the compilation pass, so this seems to be a strange interaction between the plugins.
### Expected behavior
I'd assume there should be no errors.
### Reproduction
Please see https://stackblitz.com/edit/htmlplugin-t3ibcm
It should start building automatically and display the error in both terminal and the right hand side. If it does not start automatically, use in the terminal: `npm install && npm start`
### System Info
```shell
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.18.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.4.2 - /usr/local/bin/npm
pnpm: 8.6.12 - /usr/local/bin/pnpm
npmPackages:
@intlify/unplugin-vue-i18n: ^1.4.0 => 1.4.0
vue-i18n: ^9.5.0 => 9.5.0
```
### Screenshot

### Additional context
_No response_
### Validations
- [X] Read the [Contributing Guidelines](https://github.com/intlify/vue-i18n-next/blob/master/.github/CONTRIBUTING.md)
- [X] Read the [Documentation](https://vue-i18n.intlify.dev/)
- [X] Check that there isn't [already an issue](https://github.com/intlify/vue-i18n-next/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussions](https://github.com/intlify/vue-i18n-next/discussions)
Contributor guide
Assessment
This issue has not been assessed yet.