diff --git a/packages/uni-cli-shared/__tests__/cssScoped.spec.ts b/packages/uni-cli-shared/__tests__/cssScoped.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..4b2cb374ece9cc826ee9061fd1c4edb978a90e82
--- /dev/null
+++ b/packages/uni-cli-shared/__tests__/cssScoped.spec.ts
@@ -0,0 +1,15 @@
+import { addScoped } from '../src/vite/plugins/cssScoped'
+describe('css scoped', () => {
+ test('add scoped', () => {
+ expect(addScoped(``)).toBe(``)
+ expect(addScoped(``)).toBe(
+ ``
+ )
+ expect(addScoped(``)).toBe(``)
+ expect(
+ addScoped(``)
+ ).toBe(
+ ``
+ )
+ })
+})
diff --git a/packages/uni-cli-shared/src/vite/plugins/cssScoped.ts b/packages/uni-cli-shared/src/vite/plugins/cssScoped.ts
index 76205823854619a0ddc2690d5ee750e592839428..ffc40fb5fd677f4379263189c2e593d72fbe47bd 100644
--- a/packages/uni-cli-shared/src/vite/plugins/cssScoped.ts
+++ b/packages/uni-cli-shared/src/vite/plugins/cssScoped.ts
@@ -9,11 +9,13 @@ const debugScoped = debug('uni:scoped')
const SCOPED_RE = /