Update HMR. Make it true HMR. Add URL to page server props
This commit is contained in:
+5
-18
@@ -5,25 +5,12 @@ import tailwindcss from "@tailwindcss/postcss";
|
||||
import { readFile } from "fs/promises";
|
||||
import grabDirNames from "../../../utils/grab-dir-names";
|
||||
import path from "path";
|
||||
const tailwindPlugin = {
|
||||
name: "tailwindcss",
|
||||
setup(build) {
|
||||
build.onLoad({ filter: /\.css$/ }, async (args) => {
|
||||
const source = await readFile(args.path, "utf-8");
|
||||
const result = await postcss([tailwindcss()]).process(source, {
|
||||
from: args.path,
|
||||
});
|
||||
return {
|
||||
contents: result.css,
|
||||
loader: "css",
|
||||
};
|
||||
});
|
||||
},
|
||||
};
|
||||
export default async function grabFilePathModule({ file_path, }) {
|
||||
import tailwindEsbuildPlugin from "./tailwind-esbuild-plugin";
|
||||
export default async function grabFilePathModule({ file_path, out_file, }) {
|
||||
const dev = isDevelopment();
|
||||
const { BUNX_CWD_MODULE_CACHE_DIR } = grabDirNames();
|
||||
const target_cache_file_path = path.join(BUNX_CWD_MODULE_CACHE_DIR, `${path.basename(file_path)}.js`);
|
||||
const target_cache_file_path = out_file ||
|
||||
path.join(BUNX_CWD_MODULE_CACHE_DIR, `${path.basename(file_path)}.js`);
|
||||
await esbuild.build({
|
||||
entryPoints: [file_path],
|
||||
bundle: true,
|
||||
@@ -36,7 +23,7 @@ export default async function grabFilePathModule({ file_path, }) {
|
||||
"process.env.NODE_ENV": JSON.stringify(dev ? "development" : "production"),
|
||||
},
|
||||
metafile: true,
|
||||
plugins: [tailwindPlugin],
|
||||
plugins: [tailwindEsbuildPlugin],
|
||||
jsx: "automatic",
|
||||
outfile: target_cache_file_path,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user