unocss / unocss

The instant on-demand atomic CSS engine.

Home Page:https://unocss.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TransformerVariantGroup conflicts with vite-plugin-vue-i18n and causes vite build to fail when sourcemaps: true

stephenhebert opened this issue · comments

TransformerVariantGroup conflicts with vite-plugin-vue-i18n and causes vite build to fail when sourcemaps: true

Minimal reproduction with all packages @latest:
https://github.com/stephenhebert/vue-i18n-unocss-issue-reproduction

The error:

> vite build

vite v2.9.6 building for production...
✓ 34 modules transformed.
rendering chunks (1)...Multiple conflicting contents for sourcemap source /Users/stephenhebert/source/repos/vue-i18n-unocss-issue-reproduction/src/HelloWorld.vue
error during build:
Error: Multiple conflicting contents for sourcemap source /Users/stephenhebert/source/repos/vue-i18n-unocss-issue-reproduction/src/HelloWorld.vue
    at error (/Users/stephenhebert/source/repos/vue-i18n-unocss-issue-reproduction/node_modules/rollup/dist/shared/rollup.js:198:30)
    at Link.traceMappings (/Users/stephenhebert/source/repos/vue-i18n-unocss-issue-reproduction/node_modules/rollup/dist/shared/rollup.js:14020:32)
    at collapseSourcemaps (/Users/stephenhebert/source/repos/vue-i18n-unocss-issue-reproduction/node_modules/rollup/dist/shared/rollup.js:14113:63)
    at Chunk.render (/Users/stephenhebert/source/repos/vue-i18n-unocss-issue-reproduction/node_modules/rollup/dist/shared/rollup.js:14978:19)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /Users/stephenhebert/source/repos/vue-i18n-unocss-issue-reproduction/node_modules/rollup/dist/shared/rollup.js:16074:40
    at async Promise.all (index 0)
    at async Bundle.addFinalizedChunksToBundle (/Users/stephenhebert/source/repos/vue-i18n-unocss-issue-reproduction/node_modules/rollup/dist/shared/rollup.js:16072:9)
    at async Bundle.generate (/Users/stephenhebert/source/repos/vue-i18n-unocss-issue-reproduction/node_modules/rollup/dist/shared/rollup.js:16052:13)
    at async /Users/stephenhebert/source/repos/vue-i18n-unocss-issue-reproduction/node_modules/rollup/dist/shared/rollup.js:23679:27
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ build: `vite build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/stephenhebert/.npm/_logs/2022-04-27T17_24_11_232Z-debug.log

It seems that having these two things in the same file is causing the issue, though neither on its own would cause a failure:

UnoCSS Variant Group:

<div class="lt-sm:(text-white max-w-292px)">Hello World</div>

Vue I18n SFC block:

<i18n>
{
  "en": {
    "Twitter": "Twitter"
  },
  "es": {
  }
}
</i18n>
  • this also seems to only happen if more than one locale is provided

@stephenhebert using your repo with pnpm just works (pnpm install && pnpm run build):

EDIT: I'll check with npm

imagen

@stephenhebert also working with npm, check your node and npm versions:

imagen

Thanks, @userquin

These are my node and npm versions:

Node: 14.17.3 - ~/.nvm/versions/node/v14.17.3/bin/node
npm: 6.14.13 - ~/.nvm/versions/node/v14.17.3/bin/npm

Which versions are required?

It also fails with:
npm v8.3.1
node v16.14.0

Tested by someone else on my team

@stephenhebert uhmm, I've these versions (with nvm):

node --version && npm --version
v16.13.0
8.1.0

image

with node v16.14.0 and npm 8.3.1

@userquin

It seems that this may be platform dependent. This seems to work fine in Windows 10, but fail in MacOS and Ubuntu

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Update: This is still an issue.

It seems that it builds fine in windows, but fails on other platforms.

Here's the same issue in the vite-plugin-vue-i18n repo: intlify/bundle-tools#107