mzgoddard / hard-source-webpack-plugin

https://www.npmjs.com/package/hard-source-webpack-plugin
ISC License
2.71k stars 160 forks source link

Cache rebuile every time #420

Open ikobe-zz opened 6 years ago

ikobe-zz commented 6 years ago

Expected Behavior

Expect cache will work

Actual Behavior

default

Cache not work

Each time start up, cache will rebuild

Is an error being thrown?

[hardsource:cloud] Cache is corrupted. Error: ENOENT: no such file or directory, open './run/webpack_cache/hard_source/cloud/module~/log0053' [hardsource:cloud] Last compilation did not finish saving. Building new cache.

Steps to Reproduce

  return new HardSourceWebpackPlugin({
    cacheDirectory: `${path.join(process.cwd(), './run/webpack_cache/hard_source/[confighash]')}`,
    configHash: process.env.EGG_DEPLOY === 'cloud' ? 'cloud' : 'default',
    cachePrune: {
      sizeThreshold: 300 * 1024 * 1024,  // 300 MB
    },
  });

Operating System, Node, and NPM dependency versions

Mac OS 10.11.6
Node 8.9.1

"hard-source-webpack-plugin": "^0.12.0",
WhoAteDaCake commented 6 years ago

Same when using yarn with: "hard-source-webpack-plugin": "^0.12.0" "webpack": "^4.6.0"

EDIT: Downgrading to 0.11.1 seems to have solved it, however reading from cache is actually slower than just rebuilding

borntorun commented 5 years ago

Only works when comenting "cacheDirectory" and using default config.