SimonDegraeve / hapi-webpack-plugin

Webpack middleware for Hapi. Supports HMR.
57 stars 25 forks source link

Webpack 4 compatibility #18

Open vraptor75011 opened 6 years ago

vraptor75011 commented 6 years ago

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

djllhs commented 6 years ago

I have the same problem

djllhs commented 6 years ago

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

brianwachira commented 5 years ago

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! wise-sayings@1.0.0 dev: cross-env NODE_ENV=development webpack-dev-server --open --hot npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the wise-sayings@1.0.0 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 commented 5 years ago

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! wise-sayings@1.0.0 dev: cross-env NODE_ENV=development webpack-dev-server --open --hot npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the wise-sayings@1.0.0 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 webpacl-dev-server@3.1.14'
  4. Install vue loader 14.2.2 This is because it requires a vue loader and the latest one still has bugs npm add vue-loader@14.2.2 I hope this helps somebody
itsezc commented 5 years ago

Can confirm this issue still exists

Kamahl19 commented 5 years ago

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

nwhitmont commented 4 years ago

Any plans to support Webpack 4.x @SimonDegraeve ?

createthis commented 4 years ago

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.