-
Notifications
You must be signed in to change notification settings - Fork 12k
ERROR in Cannot read property 'getSourceFile' of undefined #5329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The error lies in node_modules@ngtools\webpack\src\compiler_host.js in function _resolve(path), when the operating system is Windows. |
horrible error message |
This error literally cost me 5 hours debugging. Replacing with
solved it for me thought. @Dobryvechir's code was missing a backslash:
|
I have the same problem. After changing this method, the error persists: ERROR in Cannot read property 'getSourceFile' of undefined
The references:
|
I'm on Windows 10 using You can paste this into your // workaround https://github.com/angular/angular-cli/issues/5329
var aotPlugin = new ngToolsWebpack.AotPlugin({
tsConfigPath: "./tsconfig.aot.json",
entryModule: path.resolve(__dirname, "./ClientApp/components/main.module#MainModule"),
});
aotPlugin._compilerHost._resolve = function(path_to_resolve) {
path_1 = require("path");
path_to_resolve = aotPlugin._compilerHost._normalizePath(path_to_resolve);
if (path_to_resolve[0] == '.') {
return aotPlugin._compilerHost._normalizePath(path_1.join(aotPlugin._compilerHost.getCurrentDirectory(), path_to_resolve));
}
else if (path_to_resolve[0] == '/' || path_to_resolve.match(/^\w:\//)) {
return path_to_resolve;
}
else {
return aotPlugin._compilerHost._normalizePath(path_1.join(aotPlugin._compilerHost._basePath, path_to_resolve));
}
}; |
Thanks for sharing @tinchou! That fixed it for me. Was having the same problem on Windows 10....wasted more time than I care to admit on this issue. :-) |
Yeah, that sucks. The problem is not knowing which one is the broken
component after a big update. I was lucky I was glancing over that repo's
issues a couple of hours before updating myself.
|
@tinchou can you share plugins context of your webpack config for this workaround? |
What do you mean? This? plugins: [
aotPlugin,
new webpack.optimize.UglifyJsPlugin({
mangle: { screw_ie8: true },
compress: {
screw_ie8: true,
warnings: false,
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
// .... |
@tinchou yea thanks, i had dumb mistake with var aotPlugin = new ngToolsWebpack.AotPlugin({ part defined after webpack config instead of before |
@tinchou screw_ie8: true, is default. You don't need that. |
where is this
expanding that:
|
I'm not using the CLI, but webpack with @ngtools/webpack plugin. I think
you can "eject" your webpack configuration with the CLI if you need to use
this workaround.
…On Fri, Apr 14, 2017, 16:29 Brad Kent ***@***.***> wrote:
where is this webpack.config.js file everyone speaks of along with the
aotPlugin settings?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5329 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABeg9O6VT8ZXHl7bn2UfC4TJ4KuCPcWjks5rv8kdgaJpZM4MX7At>
.
|
thx @tinchou for the workaround, works perfectly for me (win7x64) |
Any ETA for when a final fix for this will be deployed? Thanks |
Deployed in 1.3.1 |
thx @hheexx . bugfix confirmed. |
Fixed by #6063 |
I solved min by pressing Ctrl + C on the terminal to end the current npm start, This error occurred to me when I was switching branches. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Hi, I am trying to configure webpack in order to work with AOT, however I am getting this error. I tried with changing versions but without success, in some cases I even got more errors.
OS?
Windows 10
Versions.
Node: v7.6.0
@ngtools/webpack: 1.2.12
Repro steps.
https://github.com/milenkovic/webpack-angular-aot
npm install
npm run project-aot
The log given by the failure.
ERROR in Cannot read property 'getSourceFile' of undefined
ERROR in C:/Workspace/webpack-aot/public/javascripts/core/projects/main.aot.ts (3,34): Cannot find module './ngfactory/public/javascripts/core/projects/app.module.ngfactory'.)
ERROR in ./public/javascripts/core/projects/main.aot.ts
Module not found: Error: Can't resolve './ngfactory/public/javascripts/core/projects/app.module.ngfactory' in 'C:\Workspace\webpack-aot\public\javascripts\core\projects'
@ ./public/javascripts/core/projects/main.aot.ts 3:0-103
The text was updated successfully, but these errors were encountered: