File tree Expand file tree Collapse file tree 2 files changed +14
-16
lines changed
Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Original file line number Diff line number Diff line change 11import "./env.mjs"
2- // import { build } from "velite"
2+ import { build } from "velite"
33
44/** @type {import('next').NextConfig } */
55const nextConfig = {
66 images : {
77 domains : [ "avatars.githubusercontent.com" ] ,
88 } ,
99 webpack : config => {
10- // config.plugins.push(new VeliteWebpackPlugin())
10+ config . plugins . push ( new VeliteWebpackPlugin ( ) )
1111 return config
1212 }
1313}
1414
15- // class VeliteWebpackPlugin {
16- // static started = false
17- // apply(/** @type {import('webpack').Compiler } */ compiler) {
18- // // executed three times in nextjs
19- // // twice for the server (nodejs / edge runtime) and once for the client
20- // compiler.hooks.beforeCompile.tapPromise('VeliteWebpackPlugin', async () => {
21- // if (VeliteWebpackPlugin.started) return
22- // VeliteWebpackPlugin.started = true
23- // const dev = compiler.options.mode === 'development'
24- // await build({ watch: dev, clean: !dev })
25- // })
26- // }
27- // }
15+ class VeliteWebpackPlugin {
16+ static started = false
17+ apply ( compiler ) {
18+ compiler . hooks . beforeCompile . tapPromise ( 'VeliteWebpackPlugin' , async ( ) => {
19+ if ( VeliteWebpackPlugin . started ) return
20+ VeliteWebpackPlugin . started = true
21+ const dev = compiler . options . mode === 'development'
22+ await build ( { watch : dev , clean : ! dev } )
23+ } )
24+ }
25+ }
2826
2927export default nextConfig
Original file line number Diff line number Diff line change 88 },
99 "scripts" : {
1010 "dev" : " next dev" ,
11- "build" : " velite && next build" ,
11+ "build" : " next build" ,
1212 "turbo" : " next dev --turbo" ,
1313 "start" : " next start" ,
1414 "lint" : " next lint" ,
You can’t perform that action at this time.
0 commit comments