mirror of
https://github.com/shadcn-ui/taxonomy
synced 2026-05-24 09:48:32 +00:00
feat: start velite without webpack plugin
This commit is contained in:
parent
ad3e78032b
commit
e870ae61cb
2 changed files with 6133 additions and 5039 deletions
|
|
@ -1,26 +1,17 @@
|
|||
import "./env.mjs"
|
||||
import { build } from "velite"
|
||||
|
||||
const isDev = process.argv.indexOf('dev') !== -1
|
||||
const isBuild = process.argv.indexOf('build') !== -1
|
||||
if (!process.env.VELITE_STARTED && (isDev || isBuild)) {
|
||||
process.env.VELITE_STARTED = '1'
|
||||
const { build } = await import('velite')
|
||||
await build({ watch: isDev, clean: !isDev })
|
||||
}
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
images: {
|
||||
domains: ["avatars.githubusercontent.com"],
|
||||
},
|
||||
webpack: config => {
|
||||
config.plugins.push(new VeliteWebpackPlugin())
|
||||
return config
|
||||
}
|
||||
}
|
||||
|
||||
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 })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
11147
pnpm-lock.yaml
11147
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue