hard-source-webpack-plugin icon indicating copy to clipboard operation
hard-source-webpack-plugin copied to clipboard

Error when using with webpack 5

Open daveisfera opened this issue 5 years ago • 8 comments

Expected Behavior

Can be used with webpack 5 (currently being beta tested)

Actual Behavior

Errors out

Is an error being thrown?

Webpack Bundle Error :::: TypeError: Cannot read property 'tap' of undefined
    at Object.exports.tap (/Users/dlj/projects/my_test/web/node_modules/hard-source-webpack-plugin/lib/util/plugin-compat.js:118:25)
    at new CacheSerializerFactory (/Users/dlj/projects/my_test/web/node_modules/hard-source-webpack-plugin/lib/CacheSerializerFactory.js:94:18)
    at HardSourceWebpackPlugin.apply (/Users/dlj/projects/my_test/web/node_modules/hard-source-webpack-plugin/index.js:219:36)
    at createCompiler (/Users/dlj/projects/my_test/web/node_modules/webpack/lib/webpack.js:62:12)
    at webpack (/Users/dlj/projects/my_test/web/node_modules/webpack/lib/webpack.js:88:14)
    at /Users/dlj/projects/my_test/web/build.js:309:9
    at new Promise (<anonymous>)
    at processConfig (/Users/dlj/projects/my_test/web/build.js:307:12)
    at /Users/dlj/projects/my_test/web/build.js:357:20
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:62:3)
    at /Users/dlj/projects/my_test/node_modules/esm/esm.js:1:33214
    at module.exports.Q.inited.Q.module.utilSilent (/Users/dlj/projects/my_test/node_modules/esm/esm.js:1:32886)
    at process.<anonymous> (/Users/dlj/projects/my_test/node_modules/esm/esm.js:1:33184)
    at Function.<anonymous> (/Users/dlj/projects/my_test/node_modules/esm/esm.js:1:271592)
    at Function.<anonymous> (/Users/dlj/projects/my_test/node_modules/esm/esm.js:1:271332)

Steps to Reproduce

Enable hard-source-webpack-plugin with webpack 5

Operating System, Node, and NPM dependency versions

Mac OS 10.14.6
Node 12.12.0

"devDependencies": {
    "@babel/core": "~7.6.3",
    "@babel/plugin-proposal-class-properties": "~7.5.5",
    "@babel/plugin-proposal-decorators": "~7.6.0",
    "@babel/plugin-proposal-export-default-from": "~7.5.2",
    "@babel/plugin-proposal-export-namespace-from": "~7.5.2",
    "@babel/plugin-proposal-function-bind": "~7.2.0",
    "@babel/plugin-proposal-json-strings": "~7.2.0",
    "@babel/plugin-proposal-object-rest-spread": "~7.6.2",
    "@babel/plugin-syntax-dynamic-import": "~7.2.0",
    "@babel/plugin-syntax-import-meta": "~7.2.0",
    "@babel/plugin-transform-classes": "~7.5.5",
    "@babel/plugin-transform-modules-commonjs": "~7.6.0",
    "@babel/plugin-transform-spread": "~7.6.2",
    "@babel/preset-env": "~7.6.3",
    "@babel/preset-react": "~7.6.3",
    "@babel/register": "~7.6.2",
    "assets-webpack-plugin": "~3.9.10",
    "babel-loader": "~8.0.6",
    "babel-plugin-lodash": "~3.3.4",
    "clean-css": "~4.2.1",
    "css-loader": "~3.2.0",
    "hard-source-webpack-plugin": "~0.13.1",
    "less": "~3.10.3",
    "less-loader": "~5.0.0",
    "simple-progress-webpack-plugin": "~1.1.2",
    "style-loader": "~1.0.0",
    "terser-webpack-plugin": "~2.2.1",
    "thread-loader": "~2.1.3",
    "webpack": "~5.0.0-beta.1"
  } 

daveisfera avatar Oct 30 '19 08:10 daveisfera

Have the same issue, did you solve it?

Jurigag avatar Oct 31 '19 13:10 Jurigag

I just disabled this plugin to continue testing with webpack 5

daveisfera avatar Oct 31 '19 15:10 daveisfera

Isn't new webpack persistent caching making this plugin redundant?

eugeneoshepkov avatar Nov 20 '19 12:11 eugeneoshepkov

Isn't new webpack persistent caching making this plugin redundant?

You're right~ https://github.com/webpack/webpack/issues/6527

BuptStEve avatar Dec 24 '19 09:12 BuptStEve

this is pre webpack5

yodfz avatar Apr 30 '20 03:04 yodfz

You don't need this plugin with webpack@5, because webpack@5 support cache out of box https://webpack.js.org/configuration/other-options/#cache

alexander-akait avatar Sep 05 '20 14:09 alexander-akait

@mzgoddard Could you please add this information to README.md file?

wearebear80 avatar Feb 24 '21 13:02 wearebear80