Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/big-years-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@emotion/serialize': patch
---

Changed the error message "Component selectors can only be used in conjunction with @emotion/babel-plugin" to reference the new swc Emotion plugin which will support component selectors soon.
4 changes: 2 additions & 2 deletions packages/css/test/no-babel/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ exports[`css @supports 1`] = `
/>
`;

exports[`css component as selectors (object syntax) 1`] = `"Component selectors can only be used in conjunction with @emotion/babel-plugin."`;
exports[`css component as selectors (object syntax) 1`] = `"Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform."`;

exports[`css component as selectors (object syntax) 2`] = `"The above error occurred in the <Styled(div)> component:"`;

exports[`css component selectors without target 1`] = `"Component selectors can only be used in conjunction with @emotion/babel-plugin."`;
exports[`css component selectors without target 1`] = `"Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform."`;

exports[`css composition 1`] = `
.emotion-0 {
Expand Down
13 changes: 7 additions & 6 deletions packages/serialize/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ if (process.env.NODE_ENV !== 'production') {
}
}

const noComponentSelectorMessage =
'Component selectors can only be used in conjunction with ' +
'@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' +
'compiler transform.'

function handleInterpolation(
mergedProps: void | Object,
registered: RegisteredCache | void,
Expand All @@ -119,9 +124,7 @@ function handleInterpolation(
process.env.NODE_ENV !== 'production' &&
interpolation.toString() === 'NO_COMPONENT_SELECTOR'
) {
throw new Error(
'Component selectors can only be used in conjunction with @emotion/babel-plugin.'
)
throw new Error(noComponentSelectorMessage)
}
return interpolation
}
Expand Down Expand Up @@ -247,9 +250,7 @@ function createStringFromObject(
key === 'NO_COMPONENT_SELECTOR' &&
process.env.NODE_ENV !== 'production'
) {
throw new Error(
'Component selectors can only be used in conjunction with @emotion/babel-plugin.'
)
throw new Error(noComponentSelectorMessage)
}
if (
Array.isArray(value) &&
Expand Down