Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError on property 'Name' of undefined #2

Open
CarolineBoyer opened this issue Nov 21, 2019 · 2 comments
Open

TypeError on property 'Name' of undefined #2

CarolineBoyer opened this issue Nov 21, 2019 · 2 comments

Comments

@CarolineBoyer
Copy link

Thank you for the plugin and hard work.

When trying to follow exactly your exemple 'With config object' (will also happen when using the 'With configPath'), I went on and putted the server.register into a try/catch and the following error is triggered whatever I try :
TypeError: Cannot read property 'name' of undefined

This doesn't happen with other plugins or so. Do you know what I couold have done wrong ?
The trace doesn't give me much help at all :

Trace: Error when Linking Webpack ======= TypeError: Cannot read property 'name' of undefined
at start (C:\Users\name\IDEFolder\projectName\server\server.js:57:11)
at
at runMicrotasksCallback (internal/process/next_tick.js:122:5)
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)
at Function.Module.runMain (module.js:696:11)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3

Line 57 correspond to the catch error console.trace(error).

Here is an idea of the code

try {
		server.register({
  plugin: require('hapi-webpack-plugin-2'),
  options: {
    config: {
      compiler: webpack({
        // webpack options http://webpack.github.io
      }),
      assets: {
        // webpack-dev-middleware options https://github.com/webpack/webpack-dev-middleware
      },
      hot: {
        // webpack-hot-middleware options https://github.com/glenjamin/webpack-hot-middleware
      },
    },
  },
});

	} catch (errorWhenLinkingWebpack) {
		console.trace("Error when Linking Webpack ======= " + errorWhenLinkingWebpack)
	}

Any idea ? It feels to me like hapi.register can't have access to the plugin created and its name... I might be wrong though.

@0-M
Copy link

0-M commented Jan 13, 2020

@CarolineBoyer did you get this working? I'm running into the same issue w/ webpack 4 & Hapi v17

@mmatusevich
Copy link

@CarolineBoyer did you get this working? I'm running into the same issue w/ webpack 4 & Hapi v17

you can do this

server.register({
                plugin: require('hapi-webpack-plugin-2').default,
                options: {...}

that worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants