-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Showing
2 changed files
with
14 additions
and
16 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 |
---|---|---|
@@ -1,29 +1,27 @@ | ||
import "./env.mjs" | ||
// import { build } from "velite" | ||
import { build } from "velite" | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
images: { | ||
domains: ["avatars.githubusercontent.com"], | ||
}, | ||
webpack: config => { | ||
// config.plugins.push(new VeliteWebpackPlugin()) | ||
config.plugins.push(new VeliteWebpackPlugin()) | ||
return config | ||
} | ||
} | ||
|
||
// 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 }) | ||
// }) | ||
// } | ||
// } | ||
class VeliteWebpackPlugin { | ||
static started = false | ||
apply(compiler) { | ||
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 }) | ||
}) | ||
} | ||
} | ||
|
||
export default nextConfig |
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