Skip to content

Commit 1a1ae9c

Browse files
1 parent 4d68e41 commit 1a1ae9c

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

lib/stacks/next.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -335,17 +335,19 @@ const migrateTailwindToStyled = async (root, rootFolder) => {
335335
.replace(/app/, "@")
336336
.replace(/.jsx/, "");
337337

338-
if (rootFolder === "app" && newSource.includes("'use client'")) {
339-
newSource = newSource.replace(
340-
`'use client'`,
341-
`'use client'\n import { ${componentNames.join(
342-
", "
343-
)} } from '${styleFilePath}'\n`
344-
);
345-
} else {
346-
newSource =
347-
`import { ${componentNames.join(", ")} } from '${styleFilePath}'\n` +
348-
newSource;
338+
if (componentNames.length > 0) {
339+
if (rootFolder === "app" && newSource.includes("'use client'")) {
340+
newSource = newSource.replace(
341+
`'use client'`,
342+
`'use client'\n import { ${componentNames.join(
343+
", "
344+
)} } from '${styleFilePath}'\n`
345+
);
346+
} else {
347+
newSource =
348+
`import { ${componentNames.join(", ")} } from '${styleFilePath}'\n` +
349+
newSource;
350+
}
349351
}
350352

351353
const formatted = formatter(newSource);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-r3f-app",
3-
"version": "1.6.7",
3+
"version": "1.6.8",
44
"description": "The easiest and fastest way to create new 3D web projects with react and threejs.",
55
"contributors": [
66
"Renaud ROHLINGER <[email protected]>"

0 commit comments

Comments
 (0)