question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getOptions: Cannot read property 'elm' of undefined

See original GitHub issue

I’m noticing that when calling getOptions here the check for this.options.elm fails here. The exact error is:

Module build failed: TypeError: Cannot read property 'elm' of undefined
    at Object.getOptions (./node_modules/elm-webpack-loader/index.js:37:36)
    at Object.module.exports (./node_modules/elm-webpack-loader/index.js:117:28)

Changing the offending line:

var globalOptions = this.options.elm || {};

…to the following fixes things:

var globalOptions = (this.options && this.options.elm) || {};

…however after studying the code I’m looks as though this.options will always be undefined.

This is with Webpack 4.0.0-beta.0, however I’m also unable to get either of the examples working. Is this a patch worth submitting, or am I missing something?

The very barebones source I’ve been working with is here:

https://github.com/meowgorithm/elm-webpack4-example

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
skibaacommented, Feb 28, 2018

Webpack 4.0.0 is released already. Same problem exists.

1reaction
eeue56commented, Mar 9, 2018

Not yet. Was planning to batch some more changes. Will release this weekend

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'Elm' of undefined while using Elm 0.19 ...
The issue is that 'this' is not defined in the electron renderer; This causes scope within Elm runtime to be undefined .
Read more >
Uncaught TypeError: Cannot read property 'Elm' of undefined
Hello guys,. I am trying to get elm, phoenix and elixir to work together, but i keep on getting this error. "Uncaught TypeError:...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
Cannot read property childNodes of undefined, with extension ...
This error usually happens when some external JavaScript modifies DOM owned by Elm. I think this is a general problem for VirtualDOM-based rendering...
Read more >
merge的搜索结果_第94页_菜鸟教程网
vue写的多页面应用,打包后访问报错:Cannot read property 'call' of undefined ... uiJqLinkingFunction(scope, elm, attrs) { function getOptions(){ var ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found