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

@linaria/shaker: exports/object issue with TS #861

Closed
layershifter opened this issue Nov 3, 2021 · 0 comments
Closed

@linaria/shaker: exports/object issue with TS #861

layershifter opened this issue Nov 3, 2021 · 0 comments
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked cat: typings 👮 Typescript types related issues needs: complete repro 🖥️ Issue need to have complete repro provided

Comments

@layershifter
Copy link
Contributor

layershifter commented Nov 3, 2021

Environment

  • Linaria version: @linaria/shaker@3.0.0-beta.13
  • Bundler (+ version): N/A
  • Node.js version: 12.14
  • OS: Windows 10 (do not depend on OS)

Description

This problem was found by VR tests in microsoft/fluentui#20455 and is related to how TS compiles some object usages.

export const markLabelClassName = "foo";
export const useMarksWrapperStyles = {
  [markLabelClassName]: true
};

⬇⬇⬇

var _a;
export var markLabelClassName = "foo";
export var useMarksWrapperStyles =
  ((_a = {}), (_a[markLabelClassName] = true), _a);

I created a simplified problem on StackBlitz, here we go:

❯ node using-babel
fixtureName failing
exports['fooStyles'] { 'fui-Slider-label': true }
exports['barStyles'] { 'fui-Slider-label': true }
❯ node using-shaker
fixtureName failing
mod.exports['fooStyles'] { undefined: true }
mod.exports['barStyles'] { 'fui-Slider-label': true }

Reproducible Demo

https://stackblitz.com/edit/node-fupatg

@layershifter layershifter 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 Nov 3, 2021
@github-actions github-actions bot added cat: typings 👮 Typescript types related issues and removed needs: triage 🏷 Issue needs to be checked and prioritized labels Nov 3, 2021
@Anber Anber closed this as completed in acdbdfe Nov 5, 2021
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 cat: typings 👮 Typescript types related issues needs: complete repro 🖥️ Issue need to have complete repro provided
Projects
None yet
Development

No branches or pull requests

1 participant