-
Notifications
You must be signed in to change notification settings - Fork 155
feat(@ngtools/webpack): resolve all file requests with the virtual fs #887
Conversation
@@ -18,17 +18,16 @@ export class VirtualFileSystemDecorator implements InputFileSystem { | |||
private _webpackCompilerHost: WebpackCompilerHost, | |||
) { } | |||
|
|||
// We only need to intercept calls to individual files that are present in WebpackCompilerHost. | |||
private _readFileSync(path: string): string | null { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Webpack filesystems return a Buffer not a string. This will break any file type that is not text (e.g., JPG, WOFF, etc.) or uses non-default text encoding (i.e., not UTF8 without a BOM).
This only currently works because only source code is returned from the host which is known text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I'll keep digging into that. Do you have some ideas we might try?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Unfortunately, it is a decent amount of work. The WebpackCompilerHost
would need to be refactored to internally use Buffer
objects to store the data and then convert to strings where needed inside the WebpackCompilerHost
. And then provide Buffer
return objects for the read calls within the webpack filesystem decorators.
Hey @clydin, I've modified the |
Rebasing on top of master fixed the builds. 10x for the suggestion, @filipesilva :) |
FYI this is a feature and will not be released until 6.1. |
fixes #885