Comments (31)
@sokra roger, we'll move in that direction. That's likely to fix other issues we were having. For now we're pinning [email protected]
in @ngtools/webpack
and putting out an emergency release.
Thank you so much for looking into this. 💯
from enhanced-resolve.
👍 It's not said enough: Thank you to both Filipe and Tobias for your quick responses. This issue is only 8 hours old and already we have Webpack
and Angular-CLI
core members providing good insight.
from enhanced-resolve.
I'm away from the workstation so can't look into the commit further, but will in a few hours. Thanks for narrowing it down @sokra 👍
from enhanced-resolve.
ok I found the issue.
The WebpackCompilerHost
accesses fs._statStorage.data[path]
assuming that fs
is a CachedFileSystem
from enhanced-resolve.
Instead of creating a virtual filesystem by decorating the filesystem instance WebpackCompilerHost
injects data into the private cache of the filesystem. That's not ok.
It's broken now, because data
changed from object
to Map
. I won't fix this on enhanced-resolve side. This need to be fixed in the WebpackCompilerHost
class.
Instead of injecting the values, hook into the Compiler environment
hook and decorate the filesystem:
const vfs = new VirtualFileSystemDecorator(compiler.inputFileSystem);
compiler.inputFileSystem = vfs;
...
vfs.set("/some/path", ...);
The VirtualFileSystemDecorator
redirects all calls to the underlying fs, except overwritten ones.
from enhanced-resolve.
I can confirm it's working with the emergency release. Thanks a lot!
from enhanced-resolve.
Hi there,
I'm one of the maintainers of @angular/cli
. It seems the recent 3.4.0
breaks @ngtools/webpack
, which is at the core @angular/cli
(angular/angular-cli#7113).
In the https://github.com/webpack/enhanced-resolve/releases/tag/v3.4.0 release I only see performance changes so am not too sure what changed that breaks our stuff.
Our direct usage of enhanced-resolve
is contained in https://github.com/angular/angular-cli/blob/master/packages/@ngtools/webpack/src/paths-plugin.ts.
Is there anything that comes to mind we need to change to support ^3.4.0
?
Thanks for your time.
from enhanced-resolve.
bisect says 03ef8f2
from enhanced-resolve.
nevermind I can use the repro case from the angular issue
from enhanced-resolve.
@sokra I'll get you a isolated webpack config that exhibits this error.
from enhanced-resolve.
Thanks. I'll look into it.
from enhanced-resolve.
There is an official API => Create a Decorator for the filesystem. Pass this decorated filesystem as option to the Resolver factory (for enhanced-resolve). Resp. set inputFileSystem
on the Compiler
in the environment
hook (for webpack).
from enhanced-resolve.
That would be great. Seem to be related to the AOT virtual filesystem thing...
from enhanced-resolve.
Here it is:
git clone https://github.com/filipesilva/ngtools-bug
cd ngtools-bug
npm run webpack # this will show errors
npm i [email protected]
npm run webpack # this will show no errors
from enhanced-resolve.
I agree, it's related to the virtual filesystem indeed. I can't contact it's author right now but can try to figure it out myself if you have any idea of what changed that we should incorporate.
from enhanced-resolve.
Same issue here. Need to revert to 3.3.0 to fix the issue.
from enhanced-resolve.
Sounds good
from enhanced-resolve.
Is my guess correct that several different projects are trying to inject fake/virtual files into the webpack FS cache and all broke because the internals that they were using changed? If so I think that caused us problems too. Could we get an official API to allow us to add virtual files to the webpack FS?
from enhanced-resolve.
@briandipalma here's an example of how we're doing it in Angular CLI: angular/angular-cli#7471
from enhanced-resolve.
@Basel78 heya, issues like that should be opened against https://github.com/angular/angular-cli/ and not here. The problem described here hasn't affected Angular CLI projects for a while, so I don't think the problem you are experiencing is related. Please make sure to check the existing issues and https://github.com/angular/angular-cli/wiki/stories-linked-library before opening a new issue though.
from enhanced-resolve.
@briandipalma heya, I was having some more trouble with file watchers in the virtual file system, which I documented here: webpack/webpack#5824. I initially reported it as a bug but it's really just a matter of decorating NodeWatchFileSystem
as well.
from enhanced-resolve.
Exactly same issue here
from enhanced-resolve.
Yup, same issue here. Took some time to find the cause!
from enhanced-resolve.
Glad we found this, same issue here
from enhanced-resolve.
Could you run webpack with --display-error-details
resp. stats.errorDetails: true
?
A repro case would be great.
from enhanced-resolve.
If you want watching to work consider the same for Compiler.watchFileSystem
...
from enhanced-resolve.
Thanks guys, I close the issue.
from enhanced-resolve.
Thanks for the reply, is there an example of what you are talking about somewhere?
from enhanced-resolve.
Why is this issue closed ? It's still not fixed in [email protected]
from enhanced-resolve.
Hi people,
I am relatively new to angular, just started 2 months ago, learning about stuff like: Typescript,angular, bundle, NgModule, Rollup,Webpack,.."I had angularJS previous experience and longer .NET" after building my first word addin using angular2/typescript
I started looking deep into angular-cli and building libraries with I faced some problems and solved most of it until I was stopped by the error "Error: Can't resolve './$$_gendir/app/app.module.ngfactory'" when I add my library that was build using https://github.com/jvandemo/generator-angular2-library
then I found the issue addressed here and followed the instructions as mentioned by "filipesilva" in the link above on his comments, I updated the package.json and packages/@ngtools/webpack/package.json as said but couldn't find yarn.lockfile in angular-cli project..
anyway I run "ng build --aot" and still getting the same error when run "ng serve" its gone and the site started but I am getting the sad error "vendor.bundle.js:16342 Uncaught Error: Unexpected value 'AppRoutingModule' imported by the module 'AppModule'. Please add a @NgModule annotation"
Please advice me how to resolve this issue, is there a better why to build and consume angular libraries
Thanks
from enhanced-resolve.
@filipesilva will do thanks for your response and help
from enhanced-resolve.
Thanks for the heads up @filipesilva we have been seeing issues on file watch rebuilds.
from enhanced-resolve.
Related Issues (20)
- CachedInputFileSystem OOM when duration is infinity HOT 5
- signature of method `stat` in interface `FileSystem` mismatches. HOT 2
- bug: exports map key with star in the middle doesn't work HOT 1
- is this possible with webpack AliasPlugin to automatically switch to a different alias when original file is deleted? HOT 7
- can't resolve exports pattern startsWith wildcards HOT 1
- Use of `extensionAlias` fails resolution of subpath exports in `exports` fields HOT 2
- resolving packages entrypoints with a non-standard node_modules HOT 4
- `exports.types` after `exports.default` HOT 5
- Hooks do not fire events from CSS/SCSS imports HOT 6
- AliasPlugin crash when file is deleted or rename (have to restart to make it work)
- Seeing "Error: No file content" for different package.json files when webpack rebuilds HOT 1
- ESM: Resolving to the wrong package with `exports` and nested same package but different versions HOT 3
- ESM: package.exports array target not conforming to the ESM specification HOT 10
- Add ability to handle win32 relative paths HOT 4
- [Feature Request]: Support resolve the modules with hard-links HOT 4
- lstat error when requiring virtual modules HOT 1
- Can i use withOptions Api ? HOT 1
- File Extension Substitution for TypeScript Support HOT 18
- pathUtils | joinCache memory leak HOT 6
- Question Regarding Restriction on "#/" in Imports Field Key
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 enhanced-resolve.