@typestyles/next 0.0.0-unstable.82ebd9c88257 → 0.0.0-unstable.835df2a09a6d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/package.json +2 -2
- package/src/build.test.ts +1 -1
package/README.md
CHANGED
|
@@ -150,6 +150,23 @@ To ship a static `typestyles.css` and avoid client-side `<style>` injection (use
|
|
|
150
150
|
|
|
151
151
|
`withTypestylesExtract` sets **`NEXT_PUBLIC_TYPESTYLES_RUNTIME_DISABLED`** via `next.config` `env` (works with **webpack and Turbopack**) and adds webpack **`DefinePlugin`** for `__TYPESTYLES_RUNTIME_DISABLED__` on client bundles when webpack runs. Example app: `examples/next-app`.
|
|
152
152
|
|
|
153
|
+
### Runtime in development, zero-runtime in production
|
|
154
|
+
|
|
155
|
+
During `next dev`, keeping the client runtime **enabled** avoids tying every style tweak to a pre-build extraction step. In production, disable injection so the browser loads one cacheable stylesheet.
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
// next.config.mjs
|
|
159
|
+
import { withTypestylesExtract } from '@typestyles/next/build';
|
|
160
|
+
|
|
161
|
+
const base = {
|
|
162
|
+
/* your config */
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export default process.env.NODE_ENV === 'production' ? withTypestylesExtract(base) : base;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
You still typically generate `typestyles.css` before production builds (CI or `prebuild`). The example app uses this pattern.
|
|
169
|
+
|
|
153
170
|
## API Reference
|
|
154
171
|
|
|
155
172
|
### getRegisteredCss
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typestyles/next",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.835df2a09a6d",
|
|
4
4
|
"description": "Next.js integration for typestyles SSR",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"react": "^18.0.0",
|
|
78
78
|
"react-dom": "^18.0.0",
|
|
79
79
|
"tsup": "^8.0.0",
|
|
80
|
-
"typestyles": "0.0.0-unstable.
|
|
80
|
+
"typestyles": "0.0.0-unstable.835df2a09a6d",
|
|
81
81
|
"typescript": "^5.4.0",
|
|
82
82
|
"webpack": "^5.97.1"
|
|
83
83
|
},
|
package/src/build.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
2
|
import type { NextConfig } from 'next';
|
|
3
3
|
import type { Configuration } from 'webpack';
|
|
4
|
-
import { withTypestylesExtract } from './build
|
|
4
|
+
import { withTypestylesExtract } from './build';
|
|
5
5
|
|
|
6
6
|
type WebpackContext = Parameters<NonNullable<NextConfig['webpack']>>[1];
|
|
7
7
|
|