Comments (15)
Since most of the code that broke isn't 100% essential for basic usage, I've created a fork that is functional with webpack 5.
The major differences are:
- The appendScriptTag option is broken
- The only checks for reloading are "this.isRunning" and "(hash !== this.lastHash)"
- this.server.notifyClients() is only passed [''] instead of the "include" variable
- (Edit) Most likely some other options are broken too, but I don't have the time to test each one
For anyone who needs just the basic function while a real fix is made, you can find the fork here:
https://github.com/int3nse-git/webpack-livereload-plugin
from webpack-livereload-plugin.
I haven't tried it.
Could you give it a test run @midnightcoder-pro and let me know what happens?
9% setup compilation LiveReloadPlugin[webpack-cli] Promise rejection: Error: MainTemplate.hooks.startup has been removed (use RuntimeGlobals.startup instead)
[webpack-cli] Error: MainTemplate.hooks.startup has been removed (use RuntimeGlobals.startup instead)
at Object.tap (/home/pavel/phprojects/omnew/src/node_modules/webpack/lib/MainTemplate.js:100:12)
at LiveReloadPlugin.applyCompilation (/home/pavel/phprojects/omnew/src/node_modules/webpack-livereload-plugin/index.js:164:42)
at Hook.eval [as call] (eval at create (/home/pavel/phprojects/omnew/src/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:206:1)
at Hook.CALL_DELEGATE [as _call] (/home/pavel/phprojects/omnew/src/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (/home/pavel/phprojects/omnew/src/node_modules/webpack/lib/Compiler.js:916:26)
at /home/pavel/phprojects/omnew/src/node_modules/webpack/lib/Compiler.js:957:29
at Hook.eval [as callAsync] (eval at create (/home/pavel/phprojects/omnew/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:22:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/pavel/phprojects/omnew/src/node_modules/tapable/lib/Hook.js:18:14)
at Compiler.compile (/home/pavel/phprojects/omnew/src/node_modules/webpack/lib/Compiler.js:952:28)
at /home/pavel/phprojects/omnew/src/node_modules/webpack/lib/Compiler.js:453:12
from webpack-livereload-plugin.
I'm a little confused, is a fix for webpack-livereload-plugin for webpack-5 still being worked on? It is the last blocking dep my project has, we use the append script option.
from webpack-livereload-plugin.
@nypinstripes check this fork, it's works with append script option :
github : https://github.com/Kooneko/livereload-webpack-plugin
npm : https://www.npmjs.com/package/@kooneko/livereload-webpack-plugin
from webpack-livereload-plugin.
It can be imported from webpack.
See: https://github.com/webpack-contrib/mini-css-extract-plugin/blob/e8a2d5a09ded967e0f4be145f1f52c1e5f7f6df1/src/CssLoadingRuntimeModule.js
I could fix this if you'd like. @statianzo, do you think a new major would be needed?
from webpack-livereload-plugin.
@TiTnOuK , I'm having the exact same error with your package installed.
from webpack-livereload-plugin.
Hey,
i'm currenlty only working on project where i use hmr.
So haven't tried to upgrade on webpack 5 sorry.
Maybe i will try to upgrade another project if nobody is working on it
from webpack-livereload-plugin.
It can be imported from webpack.
See: https://github.com/webpack-contrib/mini-css-extract-plugin/blob/e8a2d5a09ded967e0f4be145f1f52c1e5f7f6df1/src/CssLoadingRuntimeModule.jsI could fix this if you'd like. @statianzo, do you think a new major would be needed?
If itβs a matter of just conditionally using that property off the webpack package, then a minor would be fine. If the shape of the compilation given to the hook differs and requires implementation changes, then a major bump makes sense.
from webpack-livereload-plugin.
It's a bit harder than I thought. The documentation of RuntimeGlobals
is scarce. Perhaps we could use an other hook than startup
?
from webpack-livereload-plugin.
I haven't tried it.
Could you give it a test run @midnightcoder-pro and let me know what happens?
from webpack-livereload-plugin.
Thanks for testing @smadrom! Looks like some work will be needed here:
webpack-livereload-plugin/index.js
Lines 163 to 165 in 6859045
Not sure where RuntimeGlobals
is available.
from webpack-livereload-plugin.
@pataar not really documentation but this might help: https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/9d30b6a8e7f800fe4516865987977fc30d8114fb/lib/index.js#L231. I think they are essentially trying to do the same thing and it works for WP 5.
EDIT:
normalModuleFactory.hooks.afterResolve.tap(
this.constructor.name,
// Add react-refresh loader to process files that matches specified criteria
(resolveData) => {
injectRefreshLoader(resolveData.createData, matchObject);
}
);
Ignore me if I'm totally off-topic. This is the first time I'm trying to read a WP plugin code.
from webpack-livereload-plugin.
@statianzo @web-mi Hey, just checking this is on the radar, kind of in a holding pattern but don't want to let the webpack framework upgrades get too far away from us.
from webpack-livereload-plugin.
ping
from webpack-livereload-plugin.
thank you much @web-mi
from webpack-livereload-plugin.
Related Issues (20)
- Add files to watch HOT 6
- v1.1.0 doesn't seem to have the `delay` option HOT 1
- Multiple instances of livereload HOT 1
- Compatibility with CleanWebpackPlugin?
- High CPU HOT 6
- too many reloads, is my delay ignored? HOT 17
- Running app behind proxy returns "tinylr": "welcome" message, not expected dist/index,html file HOT 5
- Support reverse proxied URLs with "public_host" and "public_port" plugin configuration. HOT 2
- Configure polling on client in place of wss:// calls? HOT 4
- Cross-site cookie chrome warning HOT 2
- how do I have to configure webpack.config.js HOT 2
- TS2322: Type 'LiveReloadPlugin' is not assignable to type WebpackPluginInstance'.
- Multiple bundles on same page breaks reload
- TypeError: compiler.plugin is not a function (Webpack 5 plugin API change) HOT 1
- Upgrade tiny-lr to 2.0.0 which includes latest livereload-js HOT 1
- Add option to watch for changes on other files in the project HOT 2
- livereload snippet not being injected in certain cases
- reloads after focusing on browser
- Compability with WatchExternalFilesPlugin?
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-livereload-plugin.