Angular1-scaffold
Angular1-scaffold copied to clipboard
Any way to silence ng-metadata "Cannot find source file" warnings?
Everything is working great, but I keep getting warnings like the following when I run a build:
WARNING in ./~/ng-metadata/platform-browser-dynamic.js Cannot find source file 'platform-browser-dynamic.ts': Error: Cannot resolve 'file' or 'directory' ./platform-browser-dynamic.ts in .\Angular1-scaffold\node_modules\ng-metadata (... plus many more)
Is there anything I can do to silence only these messages?
I'm running this build on Windows 7.
Thanks!
Can you share a bit about your tsconfig.json config and how you are importing ng-metadata?
Well, I haven't made any changes to the Angular1-scaffold project, so the tsconfig.json isn't any different than what's found at: https://github.com/ngParty/Angular1-scaffold/blob/master/tsconfig.json.
The steps to reproduce for me are very straight forward:
$ git clone https://github.com/ngParty/Angular1-scaffold.git
$ cd Angular1-scaffold
$ npm run build
...everything builds fine, but I get 64 warnings.
My environment is as follows:
OS: Windows 7
Node: v7.7.1
NPM: 4.3.0
Same here:
- cloned the repo
- npm i
- npm start
OS: Windows 7 Node: v6.10.1 NPM: 3.10.10
Same here, warnings shows only on Windows (7 also in my case), Ubuntu works pretty much well.
Same here. ./~/ng-metadata is showing warnings!
I think I've been able to get to the bottom of this. After reading the following post, I discovered my problem to be in the source-map-loader: https://github.com/angular-redux/store/issues/64
For some reason, the "exclude" section was being respected on Linux, but not Windows. So after some experimentation, I discovered that I had to add another item to the "exclude" section for Windows' sake.
So here's how my module.rules[] section looked in webpack.conf.js before making the change:
{
test: /\.js$/,
use: "source-map-loader",
enforce: "pre",
"exclude": [
/\/node_modules\//,
]
},
Here's what solved my problem on a Windows 7 machine:
{
test: /\.js$/,
use: "source-map-loader",
enforce: "pre",
"exclude": [
/\/node_modules\//,
/\\node_modules\\/
]
},
Not sure if this will fix it for everyone, but I just thought I'd pass along what worked for me.
Worked here for warnings with ng2-toastr when building angular-cli & webpack.
Thanks pal, been wasting hours trying to resolve.....
Great, I think this can be closed then