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 1
1
import "./env.mjs"
2
- // import { build } from "velite"
2
+ import { build } from "velite"
3
3
4
4
/** @type {import('next').NextConfig } */
5
5
const nextConfig = {
6
6
images : {
7
7
domains : [ "avatars.githubusercontent.com" ] ,
8
8
} ,
9
9
webpack : config => {
10
- // config.plugins.push(new VeliteWebpackPlugin())
10
+ config . plugins . push ( new VeliteWebpackPlugin ( ) )
11
11
return config
12
12
}
13
13
}
14
14
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
+ }
28
26
29
27
export default nextConfig
Original file line number Diff line number Diff line change 8
8
},
9
9
"scripts" : {
10
10
"dev" : " next dev" ,
11
- "build" : " velite && next build" ,
11
+ "build" : " next build" ,
12
12
"turbo" : " next dev --turbo" ,
13
13
"start" : " next start" ,
14
14
"lint" : " next lint" ,
You can’t perform that action at this time.
0 commit comments