-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
620c7e9
commit b8bf6a8
Showing
7 changed files
with
5,054 additions
and
2,210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,6 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
# velite files | ||
.velite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Hello World | ||
description: This is our first blog post | ||
date: 2024-07-17 | ||
published: true | ||
--- | ||
|
||
# Hello World | ||
|
||
Welcome to my blog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
import { build } from "velite"; | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
export default { | ||
// othor next config here... | ||
webpack: (config) => { | ||
config.plugins.push(new VeliteWebpackPlugin()); | ||
return config; | ||
}, | ||
}; | ||
|
||
export default nextConfig; | ||
class VeliteWebpackPlugin { | ||
static started = false; | ||
apply(/** @type {import('webpack').Compiler} */ compiler) { | ||
// executed three times in nextjs | ||
// twice for the server (nodejs / edge runtime) and once for the client | ||
compiler.hooks.beforeCompile.tapPromise("VeliteWebpackPlugin", async () => { | ||
if (VeliteWebpackPlugin.started) return; | ||
VeliteWebpackPlugin.started = true; | ||
const dev = compiler.options.mode === "development"; | ||
await build({ watch: dev, clean: !dev }); | ||
}); | ||
} | ||
} |
Oops, something went wrong.