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

(intermediate value)(...) is not a function error in code immediately following index.js from object-path #116

Closed
ghost opened this issue Sep 23, 2021 · 4 comments

Comments

@ghost
Copy link

ghost commented Sep 23, 2021

image
Since upgrading object-path to 0.11.8 this error started appearing.
I think it's because of the removed ; in index.js on 4f0903f#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346L306
image
I am only using index.js in my project, could be an issue in other files as well.

@ghost ghost changed the title (intermediate value)(...) is not a function error appears in other packages (intermediate value)(...) is not a function error to code following index.js from object-path Sep 23, 2021
@ghost ghost changed the title (intermediate value)(...) is not a function error to code following index.js from object-path (intermediate value)(...) is not a function error in code immediately following index.js from object-path Sep 23, 2021
@mariocasciaro
Copy link
Owner

mariocasciaro commented Sep 23, 2021

Hi Hajdi
Where that (function() { at the end is coming from? It's not from object-path right?

@ghost
Copy link
Author

ghost commented Sep 23, 2021

No, it's from another package I have. But the problem originates from object-path, because it's not properly closed with a ; (at least in index.js which I'm using)
See this issue: https://stackoverflow.com/questions/42036349/uncaught-typeerror-intermediate-value-is-not-a-function
Downgrading object path to 0.11.7 fixes the error.

The file you see has many plugins concatenated in a single app.js file, one of which is object-path's index.js

@ghost
Copy link
Author

ghost commented Sep 23, 2021

I think just adding a ; at

})
would stabilize the package.

@ghost
Copy link
Author

ghost commented Sep 23, 2021

I realized that the problem only occurs because I minify my app.js file. Object-path works when included separately and not minified: https://jsfiddle.net/hajdi_k/Lge47nwv/ (look in resources)
image

I see a lot of resources on the net for issues with semicolons and minification. Also see this comment (on a completely different repo but similar issue) dalelotts/angular-date-time-input#21 (comment) .

I guess I can separate all files I concatenate with ; or a new line, before minifying.. My error now occured because index.js was followed by (function() { from another package.

It would be nice to not have to do this, because this occurs only on this package (so far). Others might be experiencing this issue as well and it's a bit difficult to debug.

Closing, since I can handle it when minifying.

@ghost ghost closed this as completed Sep 23, 2021
This issue was closed.
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

1 participant