Skip to content

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

Description

@layershifter

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug report 🦗Issue is probably a bug, but it needs to be checkedcat: typings 👮Typescript types related issuesneeds: complete repro 🖥️Issue need to have complete repro provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions