Comments (6)
Related: gaearon/react-transform-boilerplate#18
What do you think about using https://github.com/KeywordBrain/redbox-react ?
from webpack-hot-middleware.
I'd rather not force a dependency on react - especially as there are many more things that can break with a react rendering.
from webpack-hot-middleware.
I hacked up a proof of concept using ansi-to-html:
I had to tweak its dependency (entities
) because it requires JSON files which Webpack doesn’t resolve by default (fb55/entities#26). Worst case, we can compile ansi-to-html
to UMD ourselves and just use that fork since we likely won’t ever need to update this code.
from webpack-hot-middleware.
If anybody wants to prepare a real PR here’s what I did:
In client-overlay.js
clientOverlay.style.background = '#111';
clientOverlay.style.color = 'fff';
// ...
function showProblems(lines) {
clientOverlay.innerHTML = '';
clientOverlay.style.display = 'block';
lines.forEach(function(msg) {
var div = document.createElement('div');
div.innerHTML = msg; // <-------------------- not innerText
clientOverlay.appendChild(div);
});
};
In client
:
var strip = require('strip-ansi');
var Ansi = require('ansi-to-html'); // <----------- new stuff (as explained above we might need to create UMD for it)
var ansi = new Ansi();
var overlay;
if (typeof document !== 'undefined' && options.overlay) {
overlay = require('./client-overlay');
}
function problems(type, obj) {
if (options.warn) console.warn("[HMR] bundle has " + type + ":");
var list = [];
obj[type].forEach(function(msg) {
if (options.warn) console.warn("[HMR] " + strip(msg));
list.push(ansi.toHtml(msg)); // <---------------------------- convert here
});
if (overlay && type !== 'warnings') overlay.showProblems(list);
}
from webpack-hot-middleware.
Nice idea, I reckon a pre-built version of ansi to HTML is reasonable.
from webpack-hot-middleware.
One thing to watch for is that we should enable the escapeXML
option, as documented here: https://www.npmjs.com/package/ansi-to-html#options
from webpack-hot-middleware.
Related Issues (20)
- TypeError: cb is not a function HOT 1
- error TS2339: Property 'compilers' does not exist on type 'Compiler'. HOT 1
- Which package to use on a Deno server? HOT 1
- `webpack-hot-middleware/client?reload=true` is no longer working with webpack 5. HOT 36
- not work on webpack5 HOT 7
- Overlay is not working with Webpack 5 HOT 4
- Ignored an update to unaccepted module - No automatic page reloading with recent versions of webpack and react packages HOT 3
- Types are broken with Webpack 5 HOT 3
- `module.hot` is required ?
- enable use of other backends besides express
- when updating the example everything will break please update HOT 4
- ReDoS Vulnerability HOT 2
- Replace deprecated querystring component with builtin URLSearchParams API HOT 8
- Overlay is invalid in webpack5. Haven't you solved it yet? How long do you plan to publish it to the master? I hope you can reply
- Hot Updates not being handled by server HOT 2
- Opening 5+ tabs causes Express to hang indefinitely HOT 2
- webpack-hot-server-middleware on demand loading bug
- webpackv5 webpack-hot-server-middleware Compatibility problems HOT 1
- A Chrome specific issue, where requests are getting blocked after a handful of link clicks HOT 3
- Webpack 5: incorrect compilation error text output starting with "undefined undefined" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack-hot-middleware.