next.js/test/e2e/filesystem-cache/my-timestamp-loader.js
my-timestamp-loader.js12 lines503 B
module.exports = async function myLoader(source) {
  console.log(`Run my-timestamp-loader on ${this.resourcePath}`)
  if (this._compiler && this._compiler.__extra_delay) {
    if (!this._compilation.__extra_delay) {
      this._compilation.__extra_delay = true
      // Make webpack consider the build as large change which makes it filesystem cache it sooner
      await new Promise((resolve) => setTimeout(resolve, 2000))
    }
  }
  return source.replace(/Timestamp/g, `Timestamp = ${Date.now()}`)
}
Quest for Codev2.0.0
/
SIGN IN