Comments (9)
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.
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.
@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.
It seems that Webpack 5 watch support is currently incomplete
CC @samcooke98
from webpack-virtual-modules.
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.
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.
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.
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.
@jquense The fix published in [email protected]
from webpack-virtual-modules.
Related Issues (20)
- [Bug] Plugin causes console noise when used alongside debug.js HOT 2
- [Feature] Support removeModule API HOT 6
- [Bug] virtual module trigger extra compilation in webpack 5 HOT 5
- [Bug] Uppercase driver letter in windows
- Incorrectly used fileWatcher, that causing writeModule not trigger recompile with webpack-dev-server HOT 1
- [Feature] GetModule/ReadModule API HOT 2
- [Bug] Using React/JSX with `webpack-virtual-modules` gives error even when `@babel/preset-react` is used HOT 1
- [Bug] HOT 1
- [Question] - Is it possible generate new virtual modules based on file-system changes? HOT 1
- [Bug] ModuleNotFoundError happened ,when I compile two project in the same progress HOT 3
- [Bug] Local version of webpack-virtual-modules in next-with-linaria HOT 3
- [Question] Next.js compatibility
- [Bug] Multiple config and broken invalidation right from the start HOT 10
- [Feature] Custom URI scheme
- [Bug] Webpack 3 and 5 rebuild all virtual modules on any change HOT 2
- [Bug] Infinite loop on the webpack 5 example HOT 8
- [Bug] Question: Trigger webpack rebuild HOT 7
- [Feature] Expose types HOT 1
- [Bug] Stale virtual module contents upon ".writeModule" HOT 6
- [Bug] Compatibility with AngularCompilerPlugin HOT 1
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-virtual-modules.