macaron-css / macaron

Compiler-augmented typesafe CSS-in-JS with zero runtime, colocation, maximum safety and productivity
https://macaron.js.org/
MIT License
758 stars 18 forks source link

[URGENT] Vite 5.0.10 upgrade not working with Macaron #50

Open dugip opened 11 months ago

dugip commented 11 months ago

Macaron needs an update so that it can continue to work with the newest versions of Vite 5.x.

The error I'm getting is this:

vite v5.0.10 building for development...
✓ 170 modules transformed.
[vite:react-babel] /Users/web/g/platform-clone/frontend-packages/design-system/src/web/extracted_1fmahrf.css.ts: Identifier 'globalStyle' has already been declared. (26:9)

  24 | });
  25 | var _$macaron$$unknown6 = _$macaron$$unknown5;
> 26 | import { globalStyle, globalFontFace } from '@macaron-css/core';
     |          ^
  27 | export var _$macaron$$unknown7 = globalStyle('*, ::before, ::after', {
  28 |   boxSizing: 'border-box'
  29 | });
file: /Users/web/g/platform-clone/frontend-packages/design-system/src/web/extracted_1fmahrf.css.ts:26:9
error during build:
SyntaxError: /Users/web/g/platform-clone/frontend-packages/design-system/src/web/extracted_1fmahrf.css.ts: Identifier 'globalStyle' has already been declared. (26:9)

  24 | });
  25 | var _$macaron$$unknown6 = _$macaron$$unknown5;
> 26 | import { globalStyle, globalFontFace } from '@macaron-css/core';
     |          ^
  27 | export var _$macaron$$unknown7 = globalStyle('*, ::before, ::after', {
  28 |   boxSizing: 'border-box'
  29 | });
    at constructor (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:356:19)
    at TypeScriptParserMixin.raise (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:3223:19)
    at TypeScriptScopeHandler.declareName (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:7038:21)
    at TypeScriptParserMixin.declareNameFromIdentifier (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:7484:16)
    at TypeScriptParserMixin.checkIdentifier (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:7480:12)
    at TypeScriptParserMixin.checkLVal (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:7419:12)
    at TypeScriptParserMixin.finishImportSpecifier (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:14175:10)
    at TypeScriptParserMixin.parseImportSpecifier (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:14352:17)
    at TypeScriptParserMixin.parseImportSpecifier (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:10004:18)
    at TypeScriptParserMixin.parseNamedImportSpecifiers (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:14330:36)
    at TypeScriptParserMixin.parseImportSpecifiersAndAfter (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:14152:37)
    at TypeScriptParserMixin.parseImport (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:14145:17)
    at TypeScriptParserMixin.parseImport (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:9251:26)
    at TypeScriptParserMixin.parseStatementContent (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:12710:27)
    at TypeScriptParserMixin.parseStatementContent (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:9340:18)
    at TypeScriptParserMixin.parseStatementLike (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:12588:17)
    at TypeScriptParserMixin.parseModuleItem (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:12565:17)
    at TypeScriptParserMixin.parseBlockOrModuleBlockBody (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:13189:36)
    at TypeScriptParserMixin.parseBlockBody (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:13182:10)
    at TypeScriptParserMixin.parseProgram (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:12464:10)
    at TypeScriptParserMixin.parseTopLevel (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:12454:25)
    at TypeScriptParserMixin.parse (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:14376:10)
    at TypeScriptParserMixin.parse (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:9982:18)
    at parse (/Users/web/g/platform-clone/node_modules/@babel/parser/lib/index.js:14417:38)
    at parser (/Users/web/g/platform-clone/node_modules/@babel/core/lib/parser/index.js:41:34)
    at parser.next (<anonymous>)
    at normalizeFile (/Users/web/g/platform-clone/node_modules/@babel/core/lib/transformation/normalize-file.js:64:37)
    at normalizeFile.next (<anonymous>)
    at run (/Users/web/g/platform-clone/node_modules/@babel/core/lib/transformation/index.js:21:50)
    at run.next (<anonymous>)
    at transform (/Users/web/g/platform-clone/node_modules/@babel/core/lib/transform.js:22:33)
    at transform.next (<anonymous>)
    at step (/Users/web/g/platform-clone/node_modules/gensync/index.js:261:32)
    at /Users/web/g/platform-clone/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/Users/web/g/platform-clone/node_modules/gensync/index.js:223:11)
platform-clone/webapp 1 %

It would be greatly appreciated if an update came in sooner than later.

Mokshit06 commented 9 months ago

Thanks for reporting this, and apologies for the delayed response. On first glance, I'm not sure this has to do vite 5.x. Did this work fine for you with earlier versions? It would also be great if you could create a reproduction of this issue 🙂

dhutaryan commented 8 months ago

I have the same error for createVar and style with vite 5.0.0

Mokshit06 commented 8 months ago

Going to look into this.

dhutaryan commented 8 months ago

That's interesting. I used to @compiled/react and macaron at the same time and got this error. Then I have removed @compiled/react and it seems. the error threw away.