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

Dev Server 2.8 - Live bundle javascript fails to load #1080

Closed
mtraynham opened this issue Sep 13, 2017 · 4 comments
Closed

Dev Server 2.8 - Live bundle javascript fails to load #1080

mtraynham opened this issue Sep 13, 2017 · 4 comments

Comments

@mtraynham
Copy link
Contributor

mtraynham commented Sep 13, 2017

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Live bundle IFrame fails to load, Chrome shows:

Uncaught TypeError: e.indexOf is not a function
    at ge.fn.init.ge.fn.load (live.bundle.js:24)
    at HTMLDocument.r (live.bundle.js:1)
    at u (live.bundle.js:24)
    at l (live.bundle.js:24)

If the current behavior is a bug, please provide the steps to reproduce.
Run the IFrame live bundle

What is the expected behavior?
It runs correctly. Looks like you guys refactored the client heavily with #1058. The bug is here, https://github.com/webpack/webpack-dev-server/blob/master/client/live.js#L90. iframe.load(cb) should probably be iframe.on('load', cb).

Please mention your webpack and Operating System version.
Linux Mint 18.3
Webpack Dev Server 2.8
Webpack 3.5

@shellscape
Copy link
Contributor

shellscape commented Sep 13, 2017

@mtraynham there actually wasn't a big refactor, it was a linting implementation and cleanup. looking at the original code, https://github.com/webpack/webpack-dev-server/pull/1058/files#diff-7ca921e48f080bb70b26956b90f5229bL86, iframe.load has existed for some time.

I'm also not sure what "Run the IFrame live bundle" is referring to. Are you speaking of the modus-iframe example?

Update: it's been a while since I had to flex some jquery-foo, but the .load method is a shortcut for .on('load', cb) as can be read here: https://api.jquery.com/load-event/. It's definitely valid, so I think you may be looking in the wrong place for the culprit.

@mtraynham
Copy link
Contributor Author

mtraynham commented Sep 13, 2017

Kind of looked like it was calling this api.jquery.com/load function instead, I imagine because my bundle includes jQuery 3.2.1.

What I meant by live-bundle iframe, I have a script tag that requests for webpack-dev-server.js on some port, triggers the sockjs connection and then loads that live.bundle.js file which I guess manages the toolbar on the page.

@shellscape
Copy link
Contributor

(going off of the modus-live example) Yeah I think you're right. What's odd is that it's a valid jQuery object and element array, but the load method isn't proxying to the event handler. I reverted the code and the same symptoms exist. Looking at the PR, we updated some deps as well:

-    "jquery": "^2.2.0",
+    "jquery": "^3.2.1",

So that may have had something to do with it. I tested using .on instead and it did indeed resolve the issue. I'll prepare a fix and we'll get that out today as 2.8.1.

Thanks for triaging the issue.

@mtraynham
Copy link
Contributor Author

Much appreciated, thank you!

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

2 participants