Git Product home page Git Product logo

Comments (9)

jquense avatar jquense commented on June 1, 2024

ok one issue is that https://github.com/sysgears/webpack-virtual-modules/blob/master/index.js#L65

is a Set in webpack5, that seems to fix the issue sometimes (i can only get it actually produce updated files when running the server with the debugger attached, so maybe a timing issue?)

from webpack-virtual-modules.

jquense avatar jquense commented on June 1, 2024

More context, it's not the debugger its whether --mode development is set, or more specifically if cache: true so something is not busting the cache here

from webpack-virtual-modules.

larixer avatar larixer commented on June 1, 2024

@jquense Yes, the new watchpack was significantly changed and someone needs to find out how to properly emit the changes with this new version.

from webpack-virtual-modules.

larixer avatar larixer commented on June 1, 2024

It seems that Webpack 5 watch support is currently incomplete

CC @samcooke98

from webpack-virtual-modules.

jquense avatar jquense commented on June 1, 2024

I've narrowed down the issue a bit. The core problem is that watchers are producing a map of timestamps that are missing the virtual files. basically on rebuilds this line: https://github.com/webpack/watchpack/blob/master/lib/DirectoryWatcher.js#L737 nulls out the initial mtime for the virtual file, e.g. the watcher knows about the virtual file path but (obviously) doesn't know where it is.

Basically the timestamp stays null through rebuilds which breaks the "should rebuild" check. It seems like v5 has the opposite problem from #66 in that files never get rebuilt without the timestamps.

It should be said that this is a bug in v5, the value is a FileSystemInfoEntry object not just a timestamp. That will fix the problem for rebuilds after the first one. For the first recompile the null gets stuck until another build happens, at least in my repo.

from webpack-virtual-modules.

jquense avatar jquense commented on June 1, 2024

An alternative approach here might be to wrap the WatchFileSystem directly, fixing up the map here: https://github.com/webpack/webpack/blob/master/lib/node/NodeWatchFileSystem.js#L80 would (i think) solve the problem and avoid dealing with the craziness of watchpack

from webpack-virtual-modules.

larixer avatar larixer commented on June 1, 2024

Yeah, I'm also looking at these getTimeInfoEntries and thinking how can we deal with them? The easiest way to deal with them would be preferable

from webpack-virtual-modules.

larixer avatar larixer commented on June 1, 2024

We can call

              fileWatcher.directoryWatcher.setFileTime(
                modulePath,
                +time,
                false,
                false,
                'change'
              );

it fixes the timing, but its not the end of the journey, it seems

from webpack-virtual-modules.

larixer avatar larixer commented on June 1, 2024

@jquense The fix published in [email protected]

from webpack-virtual-modules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.