Skip to content

fix: allow iframe app to reload the page when changing the contents #2684

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

Conversation

liuruenshen
Copy link

  • [x ] This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

I didn't find any test cases that targets client-src/live/index.js, so I just ignore it.

Motivation / Use-Case

  1. Give the following webpack.config.js
var path = require('path');

module.exports = {
  entry: {
    bundle: path.resolve(__dirname, 'src/index.js')
  },
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js',
  },
  devServer: {
    contentBase: path.resolve(__dirname, 'html'),
    port: 9000,
    inline: false,
    watchContentBase: true,
    open: true,
  },
};
  1. Add this line to scripts of package.json
"start": "webpack-dev-server"
  1. Run
npm run start
  1. The browser opens a new tab http://localhost:9000/webpack-dev-server/
  2. Change the content of html/index.html
  3. LiveReload mechanism didn't work, because client-src/live/index.js didn't handle content-changed event

What does this pull request do:

  1. Add the "content-changed" event handler so whenever "content-base" gets changed, the iframe app will reload

Breaking Changes

Additional Info

@jsf-clabot
Copy link

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

@codecov
Copy link

codecov bot commented Jul 25, 2020

Codecov Report

Merging #2684 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2684   +/-   ##
=======================================
  Coverage   93.77%   93.77%           
=======================================
  Files          34       34           
  Lines        1333     1333           
  Branches      381      381           
=======================================
  Hits         1250     1250           
  Misses         81       81           
  Partials        2        2           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ab1f21...f7f7455. Read the comment docs.

@alexander-akait
Copy link
Member

Sorry inline was removed in the v4, so we don't accept anything for this

@alexander-akait
Copy link
Member

Thanks for PR, but inline was removed from webpack-dev-server@4, avoid using this

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

Successfully merging this pull request may close these issues.

3 participants