diff --git a/.changepacks/changepack_log_a-ISwIdvOV7dIVUK64mjV.json b/.changepacks/changepack_log_a-ISwIdvOV7dIVUK64mjV.json
new file mode 100644
index 00000000..f8b1fb1f
--- /dev/null
+++ b/.changepacks/changepack_log_a-ISwIdvOV7dIVUK64mjV.json
@@ -0,0 +1 @@
+{"changes":{"packages/next-plugin/package.json":"Patch"},"note":"Fix load issue","date":"2026-01-05T10:24:06.886526500Z"}
\ No newline at end of file
diff --git a/apps/landing/src/app/page.tsx b/apps/landing/src/app/page.tsx
index 493c9f29..da6bd145 100644
--- a/apps/landing/src/app/page.tsx
+++ b/apps/landing/src/app/page.tsx
@@ -1,30 +1,30 @@
-import { Box } from '@devup-ui/react'
-import { Metadata } from 'next'
-
-import { Container } from '@/components/Container'
-import { Discord } from '@/components/Discord'
-
-import { Bench } from './Bench'
-import { Feature } from './Feature'
-import { TopBanner } from './TopBanner'
-
-export const metadata: Metadata = {
- alternates: {
- canonical: '/',
- },
-}
-
-export default function HomePage() {
- return (
- <>
-
-
-
-
-
-
-
-
- >
- )
-}
+import { Box } from '@devup-ui/react'
+import { Metadata } from 'next'
+
+import { Container } from '@/components/Container'
+import { Discord } from '@/components/Discord'
+
+import { Bench } from './Bench'
+import { Feature } from './Feature'
+import { TopBanner } from './TopBanner'
+
+export const metadata: Metadata = {
+ alternates: {
+ canonical: '/',
+ },
+}
+
+export default function HomePage() {
+ return (
+ <>
+
+
+
+
+
+
+
+
+ >
+ )
+}
diff --git a/bun.lock b/bun.lock
index 6f5a33ff..b59f1195 100644
--- a/bun.lock
+++ b/bun.lock
@@ -329,11 +329,11 @@
},
"bindings/devup-ui-wasm": {
"name": "@devup-ui/wasm",
- "version": "1.0.54",
+ "version": "1.0.55",
},
"packages/bun-plugin": {
"name": "@devup-ui/bun-plugin",
- "version": "0.1.0",
+ "version": "1.0.1",
"dependencies": {
"@devup-ui/wasm": "workspace:^",
},
@@ -347,7 +347,7 @@
},
"packages/components": {
"name": "@devup-ui/components",
- "version": "0.1.38",
+ "version": "0.1.39",
"dependencies": {
"@devup-ui/react": "workspace:^",
"clsx": "^2.1",
@@ -376,7 +376,7 @@
},
"packages/eslint-plugin": {
"name": "@devup-ui/eslint-plugin",
- "version": "1.0.6",
+ "version": "1.0.7",
"dependencies": {
"@typescript-eslint/utils": "^8.51",
"typescript-eslint": "^8.51",
@@ -392,7 +392,7 @@
},
"packages/next-plugin": {
"name": "@devup-ui/next-plugin",
- "version": "1.0.63",
+ "version": "1.0.64",
"dependencies": {
"@devup-ui/wasm": "workspace:^",
"@devup-ui/webpack-plugin": "workspace:^",
@@ -411,7 +411,7 @@
},
"packages/react": {
"name": "@devup-ui/react",
- "version": "1.0.30",
+ "version": "1.0.31",
"dependencies": {
"csstype-extra": "latest",
"react": "^19.2",
@@ -431,7 +431,7 @@
},
"packages/reset-css": {
"name": "@devup-ui/reset-css",
- "version": "1.0.19",
+ "version": "1.0.20",
"dependencies": {
"@devup-ui/react": "workspace:^",
},
@@ -444,7 +444,7 @@
},
"packages/rsbuild-plugin": {
"name": "@devup-ui/rsbuild-plugin",
- "version": "1.0.46",
+ "version": "1.0.47",
"dependencies": {
"@devup-ui/wasm": "workspace:^",
},
@@ -459,7 +459,7 @@
},
"packages/vite-plugin": {
"name": "@devup-ui/vite-plugin",
- "version": "1.0.51",
+ "version": "1.0.52",
"dependencies": {
"@devup-ui/wasm": "workspace:^",
"vite": "^7.3",
@@ -474,7 +474,7 @@
},
"packages/webpack-plugin": {
"name": "@devup-ui/webpack-plugin",
- "version": "1.0.51",
+ "version": "1.0.52",
"dependencies": {
"@devup-ui/wasm": "workspace:^",
},
diff --git a/packages/next-plugin/src/__tests__/loader.test.ts b/packages/next-plugin/src/__tests__/loader.test.ts
index 72991fa1..8d09d599 100644
--- a/packages/next-plugin/src/__tests__/loader.test.ts
+++ b/packages/next-plugin/src/__tests__/loader.test.ts
@@ -13,7 +13,7 @@ import {
spyOn,
} from 'bun:test'
-import devupUILoader from '../loader'
+import devupUILoader, { resetInit } from '../loader'
let existsSyncSpy: ReturnType
let readFileSyncSpy: ReturnType
@@ -30,6 +30,7 @@ let registerThemeSpy: ReturnType
let dateNowSpy: ReturnType
beforeEach(() => {
+ resetInit()
existsSyncSpy = spyOn(fs, 'existsSync').mockReturnValue(false)
readFileSyncSpy = spyOn(fs, 'readFileSync').mockReturnValue('{}')
writeFileSpy = spyOn(fsPromises, 'writeFile').mockResolvedValue(undefined)
@@ -75,9 +76,7 @@ const waitFor = async (fn: () => void, timeout = 1000) => {
}
describe('devupUILoader', () => {
- // TEST ORDER MATTERS: First test for each mode initializes that mode
-
- // 1. First test for BUILD mode (watch: false) - covers non-watch init (lines 70-74)
+ // Test BUILD mode init (lines 68-73)
it('should use default maps in non-watch mode on init', async () => {
const asyncCallback = mock()
const defaultClassMap = { test: 'classMap' }
@@ -116,14 +115,14 @@ describe('devupUILoader', () => {
expect(asyncCallback).toHaveBeenCalledWith(null, 'code', null)
})
- // Verify non-watch init was executed
+ // Verify non-watch init was executed (lines 68-73)
expect(importFileMapSpy).toHaveBeenCalledWith(defaultFileMap)
expect(importClassMapSpy).toHaveBeenCalledWith(defaultClassMap)
expect(importSheetSpy).toHaveBeenCalledWith(defaultSheet)
expect(registerThemeSpy).toHaveBeenCalledWith(theme)
})
- // 2. First test for WATCH mode - covers watch init (lines 57-69) AND css writing (lines 96-112)
+ // Test WATCH mode init (lines 55-67) + CSS writing (lines 94-111)
it('should initialize watch mode and write css files', async () => {
existsSyncSpy.mockReturnValue(true)
readFileSyncSpy.mockReturnValue(
@@ -167,20 +166,23 @@ describe('devupUILoader', () => {
expect(asyncCallback).toHaveBeenCalledWith(null, 'code', {})
})
- // Verify watch mode init was executed
+ // Verify watch mode init was executed (lines 55-67)
+ expect(existsSyncSpy).toHaveBeenCalledWith('sheetFile')
+ expect(existsSyncSpy).toHaveBeenCalledWith('classMapFile')
+ expect(existsSyncSpy).toHaveBeenCalledWith('fileMapFile')
expect(existsSyncSpy).toHaveBeenCalledWith('themeFile')
expect(registerThemeSpy).toHaveBeenCalledWith({
colors: { primary: '#fff' },
})
- // Verify updatedBaseStyle && watch branch (lines 96-100)
+ // Verify updatedBaseStyle && watch branch (lines 94-99)
expect(writeFileSpy).toHaveBeenCalledWith(
join('cssDir', 'devup-ui.css'),
'base-css',
'utf-8',
)
- // Verify cssFile && watch branch (lines 102-112)
+ // Verify cssFile && watch branch (lines 100-111)
expect(writeFileSpy).toHaveBeenCalledWith(
join('cssDir', 'devup-ui-1.css'),
'/* watch-init.tsx 0 */',
@@ -190,8 +192,6 @@ describe('devupUILoader', () => {
expect(writeFileSpy).toHaveBeenCalledWith('fileMapFile', 'fileMap')
})
- // Remaining tests - init already done for both modes
-
it('should extract code without css in watch mode', async () => {
const asyncCallback = mock()
const t = {
diff --git a/packages/next-plugin/src/loader.ts b/packages/next-plugin/src/loader.ts
index 59e8a124..95a10a76 100644
--- a/packages/next-plugin/src/loader.ts
+++ b/packages/next-plugin/src/loader.ts
@@ -30,8 +30,7 @@ export interface DevupUILoaderOptions {
defaultClassMap: object
defaultFileMap: object
}
-// Track initialization per mode (watch vs non-watch are separate configurations)
-const initialized = { watch: false, build: false }
+let init = false
const devupUILoader: RawLoaderDefinitionFunction =
function (source) {
@@ -51,9 +50,8 @@ const devupUILoader: RawLoaderDefinitionFunction =
} = this.getOptions()
const promises: Promise[] = []
- const mode = watch ? 'watch' : 'build'
- if (!initialized[mode]) {
- initialized[mode] = true
+ if (!init) {
+ init = true
if (watch) {
// restart loader issue
// loader should read files when they exist in watch mode
@@ -122,3 +120,8 @@ const devupUILoader: RawLoaderDefinitionFunction =
return
}
export default devupUILoader
+
+/** @internal Reset init state for testing purposes only */
+export const resetInit = () => {
+ init = false
+}