hapi-webpack-plugin icon indicating copy to clipboard operation
hapi-webpack-plugin copied to clipboard

Webpack 4 compatibility

Open vraptor75011 opened this issue 6 years ago • 8 comments

When using webpack4, I get the following error. I think it s due to webpack3 dependency mixing with webpack4 new plugin system.

TypeError: Cannot read property 'additionalPass' of undefined at HotModuleReplacementPlugin.apply (/Users/vraptor/WebDev/test/node_modules/webpack/lib/HotModuleReplacementPlugin.js:32:18) at Compiler.apply (/Users/vraptor/WebDev/test/node_modules/hapi-webpack-plugin/node_modules/tapable/lib/Tapable.js:375:16) at new webpack (/Users/vraptor/WebDev/test/node_modules/hapi-webpack-plugin/node_modules/webpack/lib/webpack.js:33:19) at Object.register (/Users/vraptor/WebDev/test/node_modules/hapi-webpack-plugin/lib/index.js:44:16)

Any idea ? Thanks

vraptor75011 avatar Apr 02 '18 18:04 vraptor75011

I have the same problem

djllhs avatar May 31 '18 08:05 djllhs

@vraptor75011 I found I didn't install webpack-dev-server.You can check to see if you have installed it.

djllhs avatar Jun 01 '18 01:06 djllhs

#20 have the same problem. I pushed my vue project on GitHub but I got a warning that I need to update webpack-dev server due to cross origin issues. When I did so, npm run dev shows the error below

TypeError: Cannot read property 'additionalPass' of undefined at HotModuleReplacementPlugin.apply (/home/pc-name/node_modules/webpack/lib/HotModuleReplacementPlugin.js:31:18) at Compiler.apply (/home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/tapable/lib/Tapable.js:375:16) at webpack (/home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/webpack/lib/webpack.js:33:19) at startDevServer (/home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/webpack-dev-server/bin/webpack-dev-server.js:335:16) at portfinder.getPort (/home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/webpack-dev-server/bin/webpack-dev-server.js:323:5) at /home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/portfinder/lib/portfinder.js:190:16 at /home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/portfinder/node_modules/async/lib/async.js:52:16 at /home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/portfinder/node_modules/async/lib/async.js:269:32 at /home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/portfinder/node_modules/async/lib/async.js:44:16 at /home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/portfinder/lib/portfinder.js:151:16 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] dev: cross-env NODE_ENV=development webpack-dev-server --open --hot npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/pc-name/.npm/_logs/2019-01-15T08_51_57_626Z-debug.log

Attached is the debug log file [2019-01-15T08_51_57_626Z-debug.log](https://github.com/SimonDegraeve/hapi-webpack-plugin/files/2758821/2019-01-15T08_51_57_626Z-debug.log)

It sucks that upgrading webpack-dev-server causes npm not to run, yet GitHub issues a security alert for using webpack-dev-server version lower than 3.1.14

brianwachira avatar Jan 15 '19 09:01 brianwachira

I have the same problem. I pushed my vue project on GitHub but I got a warning that I need to update webpack-dev server due to cross origin issues. When I did so, npm run dev shows the error below

TypeError: Cannot read property 'additionalPass' of undefined at HotModuleReplacementPlugin.apply (/home/pc-name/node_modules/webpack/lib/HotModuleReplacementPlugin.js:31:18) at Compiler.apply (/home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/tapable/lib/Tapable.js:375:16) at webpack (/home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/webpack/lib/webpack.js:33:19) at startDevServer (/home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/webpack-dev-server/bin/webpack-dev-server.js:335:16) at portfinder.getPort (/home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/webpack-dev-server/bin/webpack-dev-server.js:323:5) at /home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/portfinder/lib/portfinder.js:190:16 at /home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/portfinder/node_modules/async/lib/async.js:52:16 at /home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/portfinder/node_modules/async/lib/async.js:269:32 at /home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/portfinder/node_modules/async/lib/async.js:44:16 at /home/pc-name/Documents/project-directory/vue/wise-sayings/node_modules/portfinder/lib/portfinder.js:151:16 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] dev: cross-env NODE_ENV=development webpack-dev-server --open --hot npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/pc-name/.npm/_logs/2019-01-15T08_51_57_626Z-debug.log

Attached is the debug log file 2019-01-15T08_51_57_626Z-debug.log

It sucks that upgrading webpack-dev-server causes npm not to run, yet GitHub issues a security alert for using webpack-dev-server version lower than 3.1.14 #20 I got it to work by following this steps

  1. Initialize your vue project. For now I will use vue-cli v2 vue init template-name project-name 1.1 npm install npm install
  2. Install webpack 4.0.0 dependency. It is needed npm install webpack@^4.0.0
  3. Install webpack version 3.1.11 or 3.1.14 or whichever one you want 'npm install --save-dev [email protected]'
  4. Install vue loader 14.2.2 This is because it requires a vue loader and the latest one still has bugs npm add [email protected] I hope this helps somebody

brianwachira avatar Jan 15 '19 12:01 brianwachira

Can confirm this issue still exists

itsezc avatar Mar 31 '19 09:03 itsezc

It seems this package is unmaintained so I decided to rewrite it in TS and fix all the issues. You can find it here https://github.com/Kamahl19/hapi-webpack-plugin-2

Kamahl19 avatar Jun 13 '19 13:06 Kamahl19

Any plans to support Webpack 4.x @SimonDegraeve ?

nwhitmont avatar Sep 05 '19 17:09 nwhitmont

I updated hapi-webpack-plugin in https://github.com/SimonDegraeve/hapi-webpack-plugin/issues/22 to support Webpack 4.x. There is a PR attached. Feel free to check it out.

createthis avatar Nov 22 '19 13:11 createthis