Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build errors with Linaria@5 and Rollup/Vite #1348

Closed
nstepien opened this issue Sep 25, 2023 · 2 comments · Fixed by #1356 or #1350
Closed

Build errors with Linaria@5 and Rollup/Vite #1348

nstepien opened this issue Sep 25, 2023 · 2 comments · Fixed by #1356 or #1350
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: rollup 🗞️ Issue is related to rollup bundler bundler: webpack 📦 Issue is related to webpack bundler needs: complete repro 🖥️ Issue need to have complete repro provided platform: ssr 🛠️ Issue related to SSR

Comments

@nstepien
Copy link
Contributor

Environment

  • Linaria version: 5.0.2
  • Bundler (+ version): rollup@3.29.3, vite@4.4.9
  • Node.js version: 20.7.0
  • OS: win11

Description

Linaria 5 breaks our rollup/vite builds.

Errors

rollup:

./src/index.ts → ./lib/bundle.js, ./lib/bundle.cjs...
[!] (plugin linaria) SyntaxError: D:\repos\react-data-grid\src\HeaderRow.tsx: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(cell)'.
  33 |     font-weight: bold;
  34 |
> 35 |     & > .${cell} {
     |            ^^^^
  36 |       /* Should have a higher value than 1 to show up above regular cells and the focus sink */
  37 |       z-index: 2;
  38 |       position: sticky;
src/HeaderRow.tsx
    at File.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\file\file.js:205:12)
    at NodePath.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\traverse\lib\path\index.js:101:21)
    at throwIfInvalid (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\throwIfInvalid.js:32:12)
    at templateProcessor (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\templateProcessor.js:101:35)
    at CssProcessor.build (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\TaggedTemplateProcessor.js:32:53)
    at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:32:17
    at processTemplateExpression (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\utils\processTemplateExpression.js:15:3)
    at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:31:62
    at Array.forEach (<anonymous>)
    at collector (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:30:15)
    at PluginPass.pre (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:56:26)
    at transformFile (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:73:27)
    at transformFile.next (<anonymous>)
    at run (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:24:12) 
    at run.next (<anonymous>)
    at D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:23:33
    at Generator.next (<anonymous>)
    at evaluateSync (D:\repos\react-data-grid\node_modules\gensync\index.js:251:28)
    at sync (D:\repos\react-data-grid\node_modules\gensync\index.js:89:14)
    at stopHiding - secret - don't use this - v1 (D:\repos\react-data-grid\node_modules\@babel\core\lib\errors\rewrite-stack-trace.js:47:12)
    at Object.transformFromAstSync (D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:44:83)
    at BaseAction.collect (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\generators\collect.js:51:24)
    at collect.next (<anonymous>)
    at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:78
    at EventEmitter.action (D:\repos\react-data-grid\node_modules\@linaria\utils\lib\EventEmitter.js:25:22)
    at BaseAction.emitAction (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:131:39)
    at nextFn (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:32)
    at processNext (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:111:28)
    at Object.next (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:120:9)
    at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:39:102)
    at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:46:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async transform (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform.js:95:20)
    at async Object.transform (file:///D:/repos/react-data-grid/node_modules/@linaria/rollup/dist/index.mjs:64:22)
    at async transform (D:\repos\react-data-grid\node_modules\rollup\dist\shared\rollup.js:25599:16)
    at async ModuleLoader.addModuleSource (D:\repos\react-data-grid\node_modules\rollup\dist\shared\rollup.js:25799:30)

vite build:

vite v4.4.9 building for production...
✓ 503 modules transformed.
✓ built in 4.20s
[linaria] D:\repos\react-data-grid\src\GroupRow.tsx: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(cell)'.
  15 |     }
  16 |
> 17 |     > .${cell}:not(:last-child):not(.${cellFrozenLast}) {
     |          ^^^^
  18 |       border-inline-end: none;
  19 |     }
  20 |   }
file: D:/repos/react-data-grid/src/GroupRow.tsx
error during build:
SyntaxError: D:\repos\react-data-grid\src\GroupRow.tsx: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(cell)'.
  15 |     }
  16 |
> 17 |     > .${cell}:not(:last-child):not(.${cellFrozenLast}) {
     |          ^^^^
  18 |       border-inline-end: none;
  19 |     }
  20 |   }
    at File.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\file\file.js:205:12)
    at NodePath.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\traverse\lib\path\index.js:101:21)
    at throwIfInvalid (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\throwIfInvalid.js:32:12)
    at templateProcessor (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\templateProcessor.js:101:35)
    at CssProcessor.build (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\TaggedTemplateProcessor.js:32:53)
    at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:32:17
    at processTemplateExpression (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\utils\processTemplateExpression.js:15:3)
    at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:31:62
    at Array.forEach (<anonymous>)
    at collector (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:30:15)
    at PluginPass.pre (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:56:26)
    at transformFile (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:73:27)
    at transformFile.next (<anonymous>)
    at run (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:24:12) 
    at run.next (<anonymous>)
    at D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:23:33
    at Generator.next (<anonymous>)
    at evaluateSync (D:\repos\react-data-grid\node_modules\gensync\index.js:251:28)
    at sync (D:\repos\react-data-grid\node_modules\gensync\index.js:89:14)
    at stopHiding - secret - don't use this - v1 (D:\repos\react-data-grid\node_modules\@babel\core\lib\errors\rewrite-stack-trace.js:47:12)
    at Object.transformFromAstSync (D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:44:83)
    at BaseAction.collect (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\generators\collect.js:51:24)
    at collect.next (<anonymous>)
    at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:78
    at EventEmitter.action (D:\repos\react-data-grid\node_modules\@linaria\utils\lib\EventEmitter.js:25:22)
    at BaseAction.emitAction (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:131:39)
    at nextFn (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:32)
    at processNext (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:111:28)
    at Object.next (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:120:9)
    at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:39:102)
    at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:46:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async transform (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform.js:95:20)
    at async Object.transform (file:///D:/repos/react-data-grid/node_modules/@linaria/vite/dist/index.mjs:100:22)
    at async transform (file:///D:/repos/react-data-grid/node_modules/rollup/dist/es/shared/node-entry.js:24444:16)
    at async ModuleLoader.addModuleSource (file:///D:/repos/react-data-grid/node_modules/rollup/dist/es/shared/node-entry.js:24644:30)

vite serve:

11:50:41 AM [vite] Internal server error: D:\repos\react-data-grid\src\GroupRow.tsx: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(cell)'.
  30 |     }
  31 |
> 32 |     > .${cell}:not(:last-child):not(.${cellFrozenLast}) {
     |          ^^^^
  33 |       border-inline-end: none;
  34 |     }
  35 |   }
  Plugin: linaria
  File: D:/repos/react-data-grid/src/GroupRow.tsx
      at File.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\file\file.js:205:12)
      at NodePath.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\traverse\lib\path\index.js:101:21)
      at throwIfInvalid (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\throwIfInvalid.js:32:12)
      at templateProcessor (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\templateProcessor.js:101:35)
      at CssProcessor.build (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\TaggedTemplateProcessor.js:32:53)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:32:17
      at processTemplateExpression (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\utils\processTemplateExpression.js:15:3)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:31:62
      at Array.forEach (<anonymous>)
      at collector (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:30:15)
      at PluginPass.pre (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:56:26)
      at transformFile (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:73:27)
      at transformFile.next (<anonymous>)
      at run (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:24:12)
      at run.next (<anonymous>)
      at D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:23:33
      at Generator.next (<anonymous>)
      at evaluateSync (D:\repos\react-data-grid\node_modules\gensync\index.js:251:28)
      at sync (D:\repos\react-data-grid\node_modules\gensync\index.js:89:14)
      at stopHiding - secret - don't use this - v1 (D:\repos\react-data-grid\node_modules\@babel\core\lib\errors\rewrite-stack-trace.js:47:12)
      at Object.transformFromAstSync (D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:44:83)
      at BaseAction.collect (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\generators\collect.js:51:24)
      at collect.next (<anonymous>)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:78
      at EventEmitter.action (D:\repos\react-data-grid\node_modules\@linaria\utils\lib\EventEmitter.js:25:22)
      at BaseAction.emitAction (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:131:39)
      at nextFn (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:32)
      at processNext (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:111:28)
      at Object.next (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:120:9)
      at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:39:102)
      at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:46:28)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async transform (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform.js:95:20)
      at async TransformContext.transform (file:///D:/repos/react-data-grid/node_modules/@linaria/vite/dist/index.mjs:100:22)
      at async Object.transform (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-df561101.js:44283:30)
      at async loadAndTransform (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-df561101.js:54950:29)
D:\repos\react-data-grid\src\style\core.ts: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(row)'.
  109 |     user-select: none;
  110 |
> 111 |     & .${row} {
      |          ^^^
  112 |       cursor: move;
  113 |     }
  114 |   }
D:\repos\react-data-grid\src\GroupRow.tsx: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(cell)'.
  30 |     }
  31 |
> 32 |     > .${cell}:not(:last-child):not(.${cellFrozenLast}) {
     |          ^^^^
  33 |       border-inline-end: none;
  34 |     }
  35 |   }
D:\repos\react-data-grid\src\HeaderRow.tsx: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(cell)'.
  29 |     font-weight: bold;
  30 |
> 31 |     & > .${cell} {
     |            ^^^^
  32 |       /* Should have a higher value than 1 to show up above regular cells and the focus sink */
  33 |       z-index: 2;
  34 |       position: sticky;
11:50:41 AM [vite] Internal server error: D:\repos\react-data-grid\src\HeaderRow.tsx: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(cell)'.
  29 |     font-weight: bold;
  30 |
> 31 |     & > .${cell} {
     |            ^^^^
  32 |       /* Should have a higher value than 1 to show up above regular cells and the focus sink */
  33 |       z-index: 2;
  34 |       position: sticky;
  Plugin: linaria
  File: D:/repos/react-data-grid/src/HeaderRow.tsx
      at File.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\file\file.js:205:12)
      at NodePath.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\traverse\lib\path\index.js:101:21)
      at throwIfInvalid (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\throwIfInvalid.js:32:12)
      at templateProcessor (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\templateProcessor.js:101:35)
      at CssProcessor.build (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\TaggedTemplateProcessor.js:32:53)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:32:17
      at processTemplateExpression (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\utils\processTemplateExpression.js:15:3)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:31:62
      at Array.forEach (<anonymous>)
      at collector (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:30:15)
      at PluginPass.pre (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:56:26)
      at transformFile (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:73:27)
      at transformFile.next (<anonymous>)
      at run (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:24:12)
      at run.next (<anonymous>)
      at D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:23:33
      at Generator.next (<anonymous>)
      at evaluateSync (D:\repos\react-data-grid\node_modules\gensync\index.js:251:28)
      at sync (D:\repos\react-data-grid\node_modules\gensync\index.js:89:14)
      at stopHiding - secret - don't use this - v1 (D:\repos\react-data-grid\node_modules\@babel\core\lib\errors\rewrite-stack-trace.js:47:12)
      at Object.transformFromAstSync (D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:44:83)
      at BaseAction.collect (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\generators\collect.js:51:24)
      at collect.next (<anonymous>)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:78
      at EventEmitter.action (D:\repos\react-data-grid\node_modules\@linaria\utils\lib\EventEmitter.js:25:22)
      at BaseAction.emitAction (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:131:39)
      at nextFn (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:32)
      at processNext (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:111:28)
      at Object.next (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:120:9)
      at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:39:102)
      at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:46:28)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async transform (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform.js:95:20)
      at async TransformContext.transform (file:///D:/repos/react-data-grid/node_modules/@linaria/vite/dist/index.mjs:100:22)
      at async Object.transform (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-df561101.js:44283:30)
      at async loadAndTransform (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-df561101.js:54950:29)
D:\repos\react-data-grid\src\SummaryRow.tsx: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(cell)'.
  26 |     line-height: var(--rdg-summary-row-height);
  27 |
> 28 |     > .${cell} {
     |          ^^^^
  29 |       position: sticky;
  30 |     }
  31 |   }
D:\repos\react-data-grid\src\HeaderRow.tsx: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(cell)'.
  29 |     font-weight: bold;
  30 |
> 31 |     & > .${cell} {
     |            ^^^^
  32 |       /* Should have a higher value than 1 to show up above regular cells and the focus sink */
  33 |       z-index: 2;
  34 |       position: sticky;
11:50:42 AM [vite] Internal server error: D:\repos\react-data-grid\src\style\core.ts: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(row)'.
  109 |     user-select: none;
  110 |
> 111 |     & .${row} {
      |          ^^^
  112 |       cursor: move;
  113 |     }
  114 |   }
  Plugin: linaria
  File: D:/repos/react-data-grid/src/style/core.ts
      at File.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\file\file.js:205:12)
      at NodePath.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\traverse\lib\path\index.js:101:21)
      at throwIfInvalid (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\throwIfInvalid.js:32:12)
      at templateProcessor (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\templateProcessor.js:101:35)
      at CssProcessor.build (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\TaggedTemplateProcessor.js:32:53)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:32:17
      at processTemplateExpression (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\utils\processTemplateExpression.js:15:3)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:31:62
      at Array.forEach (<anonymous>)
      at collector (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:30:15)
      at PluginPass.pre (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:56:26)
      at transformFile (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:73:27)
      at transformFile.next (<anonymous>)
      at run (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:24:12)
      at run.next (<anonymous>)
      at D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:23:33
      at Generator.next (<anonymous>)
      at evaluateSync (D:\repos\react-data-grid\node_modules\gensync\index.js:251:28)
      at sync (D:\repos\react-data-grid\node_modules\gensync\index.js:89:14)
      at stopHiding - secret - don't use this - v1 (D:\repos\react-data-grid\node_modules\@babel\core\lib\errors\rewrite-stack-trace.js:47:12)
      at Object.transformFromAstSync (D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:44:83)
      at BaseAction.collect (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\generators\collect.js:51:24)
      at collect.next (<anonymous>)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:78
      at EventEmitter.action (D:\repos\react-data-grid\node_modules\@linaria\utils\lib\EventEmitter.js:25:22)
      at BaseAction.emitAction (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:131:39)
      at nextFn (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:32)
      at processNext (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:111:28)
      at Object.next (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:120:9)
      at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:39:102)
      at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:46:28)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async transform (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform.js:95:20)
      at async TransformContext.transform (file:///D:/repos/react-data-grid/node_modules/@linaria/vite/dist/index.mjs:100:22)
      at async Object.transform (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-df561101.js:44283:30)
      at async loadAndTransform (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-df561101.js:54950:29)
      at async viteTransformMiddleware (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-df561101.js:64345:32)
11:50:42 AM [vite] Internal server error: D:\repos\react-data-grid\src\SummaryRow.tsx: The expression evaluated to 'undefined', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(cell)'.
  26 |     line-height: var(--rdg-summary-row-height);
  27 |
> 28 |     > .${cell} {
     |          ^^^^
  29 |       position: sticky;
  30 |     }
  31 |   }
  Plugin: linaria
  File: D:/repos/react-data-grid/src/SummaryRow.tsx
      at File.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\file\file.js:205:12)
      at NodePath.buildCodeFrameError (D:\repos\react-data-grid\node_modules\@babel\traverse\lib\path\index.js:101:21)
      at throwIfInvalid (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\throwIfInvalid.js:32:12)
      at templateProcessor (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\utils\templateProcessor.js:101:35)
      at CssProcessor.build (D:\repos\react-data-grid\node_modules\@linaria\tags\lib\TaggedTemplateProcessor.js:32:53)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:32:17
      at processTemplateExpression (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\utils\processTemplateExpression.js:15:3)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:31:62
      at Array.forEach (<anonymous>)
      at collector (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:30:15)
      at PluginPass.pre (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\plugins\collector.js:56:26)
      at transformFile (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:73:27)
      at transformFile.next (<anonymous>)
      at run (D:\repos\react-data-grid\node_modules\@babel\core\lib\transformation\index.js:24:12)
      at run.next (<anonymous>)
      at D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:23:33
      at Generator.next (<anonymous>)
      at evaluateSync (D:\repos\react-data-grid\node_modules\gensync\index.js:251:28)
      at sync (D:\repos\react-data-grid\node_modules\gensync\index.js:89:14)
      at stopHiding - secret - don't use this - v1 (D:\repos\react-data-grid\node_modules\@babel\core\lib\errors\rewrite-stack-trace.js:47:12)
      at Object.transformFromAstSync (D:\repos\react-data-grid\node_modules\@babel\core\lib\transform-ast.js:44:83)
      at BaseAction.collect (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\generators\collect.js:51:24)
      at collect.next (<anonymous>)
      at D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:78
      at EventEmitter.action (D:\repos\react-data-grid\node_modules\@linaria\utils\lib\EventEmitter.js:25:22)
      at BaseAction.emitAction (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:131:39)
      at nextFn (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:66:32)
      at processNext (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:111:28)
      at Object.next (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\BaseAction.js:120:9)
      at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:39:102)
      at asyncActionRunner (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform\actions\actionRunner.js:46:28)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async transform (D:\repos\react-data-grid\node_modules\@linaria\babel-preset\lib\transform.js:95:20)
      at async TransformContext.transform (file:///D:/repos/react-data-grid/node_modules/@linaria/vite/dist/index.mjs:100:22)
      at async Object.transform (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-df561101.js:44283:30)
      at async loadAndTransform (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-df561101.js:54950:29)
      at async viteTransformMiddleware (file:///D:/repos/react-data-grid/node_modules/vite/dist/node/chunks/dep-df561101.js:64345:32)

Reproducible Demo

adazzle/react-data-grid#3348

  • clone this repo
  • checkout the lin5 branch
  • Install dependencies with npm i
  • reproduce with either
    • npm run build (rollup)
    • npm run build:website (vite preview)
    • npm start (vite serve)
@nstepien nstepien added bug report 🦗 Issue is probably a bug, but it needs to be checked needs: complete repro 🖥️ Issue need to have complete repro provided needs: triage 🏷 Issue needs to be checked and prioritized labels Sep 25, 2023
@github-actions github-actions bot added bundler: rollup 🗞️ Issue is related to rollup bundler bundler: webpack 📦 Issue is related to webpack bundler platform: ssr 🛠️ Issue related to SSR and removed needs: triage 🏷 Issue needs to be checked and prioritized labels Sep 25, 2023
@layershifter
Copy link
Contributor

That's the problem with @linaria/shaker.

Input

exports.__esModule = true;
exports.cellFrozenLastClassname = exports.cellFrozenLast = exports.cellFrozenClassname = exports.cellFrozen = exports.cellClassname = exports.cell = void 0;
const cell = exports.cell = "cj343x07-0-0-beta-39";
const cellClassname = exports.cellClassname = `rdg-cell ${cell}`;
const cellFrozen = exports.cellFrozen = "csofj7r7-0-0-beta-39";
const cellFrozenClassname = exports.cellFrozenClassname = `rdg-cell-frozen ${cellFrozen}`;
const cellFrozenLast = exports.cellFrozenLast = "ch2wcw87-0-0-beta-39";
const cellFrozenLastClassname = exports.cellFrozenLastClassname = `rdg-cell-frozen-last ${cellFrozenLast}`;
exports.__linariaPreval = {};

Output

only: ['cell', 'cellFrozen']

exports.cellFrozenLastClassname = exports.cellFrozenLast = exports.cellFrozenClassname = exports.cellFrozen = exports.cellClassname = exports.cell = void 0;

@layershifter
Copy link
Contributor

@nstepien FYI the fix from #1356 should be enough for your case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: rollup 🗞️ Issue is related to rollup bundler bundler: webpack 📦 Issue is related to webpack bundler needs: complete repro 🖥️ Issue need to have complete repro provided platform: ssr 🛠️ Issue related to SSR
Projects
None yet
3 participants