diff --git a/icu.macro.js b/icu.macro.js
index 9fce21929..c16dfac23 100644
--- a/icu.macro.js
+++ b/icu.macro.js
@@ -262,9 +262,20 @@ function buildTransElement(
// add generated Trans attributes
if (!attributeExistsAlready('defaults', finalAttributes))
- finalAttributes.push(
- t.jSXAttribute(t.jSXIdentifier('defaults'), t.StringLiteral(extracted.defaults)),
- );
+ if (extracted.defaults.includes(`"`)) {
+ // wrap defaults that contain double quotes in brackets
+ finalAttributes.push(
+ t.jSXAttribute(
+ t.jSXIdentifier('defaults'),
+ t.jSXExpressionContainer(t.StringLiteral(extracted.defaults)),
+ ),
+ );
+ } else {
+ finalAttributes.push(
+ t.jSXAttribute(t.jSXIdentifier('defaults'), t.StringLiteral(extracted.defaults)),
+ );
+ }
+
if (!attributeExistsAlready('components', finalAttributes))
finalAttributes.push(
t.jSXAttribute(t.jSXIdentifier('components'), t.jSXExpressionContainer(extracted.components)),
diff --git a/test/__snapshots__/icu.macro.spec.js.snap b/test/__snapshots__/icu.macro.spec.js.snap
index 2833e5fe2..c990a387c 100644
--- a/test/__snapshots__/icu.macro.spec.js.snap
+++ b/test/__snapshots__/icu.macro.spec.js.snap
@@ -572,3 +572,18 @@ const x = exciting!0>{count, plural, =
}} />;
"
`;
+
+exports[`macros 22. macros: 22. macros 1`] = `
+"
+import { Trans } from \\"../icu.macro\\";
+
+const x = Welcome, "{ name }"!
+
+ ↓ ↓ ↓ ↓ ↓ ↓
+
+import { Trans } from \\"react-i18next\\";
+const x = ;
+"
+`;
diff --git a/test/icu.macro.spec.js b/test/icu.macro.spec.js
index 3e518f6b7..78e386ed4 100644
--- a/test/icu.macro.spec.js
+++ b/test/icu.macro.spec.js
@@ -301,6 +301,11 @@ pluginTester({
);
`,
+ `
+ import { Trans } from "../icu.macro";
+
+ const x = Welcome, "{ name }"!
+ `,
{
code: `
import React from "react"