developit / developit/microbundle

Issue Emotion.js, "illegal escape sequence in your template literal"

Đang mở
#818 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
8.1k
Fork
358
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi,
I'm having trouble when building components that use Emotion's template literal syntax.

```js
export const Component = styled.div`
background-color: 'blue';

&:hover {
background-color: 'red';
}
`
```

I get the error log:

> You have illegal escape sequence in your template literal, most likely inside content's property value.
Because you write your CSS inside a JavaScript string you actually have to do double escaping, so for example "content: '\00d7';" should become "content: '\\00d7';".

[You can read more about this here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences)

---

Technically, using `@emotion/babel-plugin`, should fix it; [see this thread](https://github.com/emotion-js/emotion/issues/1755)

Nothing seems to work, and I haven't encountered this issue using webpack on other projects.

> My `babel.config.js` does seem to be used by `microbundle`, so I don't know why I have this issue.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.