zce / velite

Turns Markdown / MDX, YAML, JSON, or others into app's data layer with Zod schema.
http://velite.js.org
MIT License
341 stars 19 forks source link

Webpack cache warning #154

Closed miekassu closed 1 month ago

miekassu commented 1 month ago

I'm getting following warning when running dev or building the app:

👾 build » compile | next build
  â–² Next.js 14.2.3
  - Environments: .env.local

   Creating an optimized production build ...
[VELITE] building...
[VELITE] issues:
content/authors/shadcn.mdx
 info The content is empty  body
[VELITE] build finished in 1444.23ms
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /...project/node_modules/velite/dist/velite-BQotdjqX.js for build dependencies failed at 'import(configUrl.href)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /...project/node_modules/velite/dist/velite-BQotdjqX.js for build dependencies failed at 'import(configUrl.href)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /...project/node_modules/velite/dist/velite-BQotdjqX.js for build dependencies failed at 'import(configUrl.href)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.

Is this warning normal? Is there some config change I might have missed?

My next.config:

import "./env.mjs"
import { build } from "velite"

/** @type {import('next').NextConfig} */
const nextConfig = {
  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 })
    })
  }
}

export default nextConfig
zce commented 1 month ago

https://github.com/zce/velite/issues/119#issuecomment-2058014933

miekassu commented 1 month ago

Thank this clear it up