Angular1-scaffold icon indicating copy to clipboard operation
Angular1-scaffold copied to clipboard

Any way to silence ng-metadata "Cannot find source file" warnings?

Open jalbr74 opened this issue 7 years ago • 8 comments

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!

jalbr74 avatar Mar 06 '17 23:03 jalbr74

Can you share a bit about your tsconfig.json config and how you are importing ng-metadata?

aciccarello avatar Mar 07 '17 00:03 aciccarello

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

jalbr74 avatar Mar 07 '17 12:03 jalbr74

Same here:

  1. cloned the repo
  2. npm i
  3. npm start

OS: Windows 7 Node: v6.10.1 NPM: 3.10.10

artem-v-shamsutdinov avatar Apr 18 '17 21:04 artem-v-shamsutdinov

Same here, warnings shows only on Windows (7 also in my case), Ubuntu works pretty much well.

kptLucek avatar Apr 20 '17 04:04 kptLucek

Same here. ./~/ng-metadata is showing warnings!

Predhin avatar May 19 '17 07:05 Predhin

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.

jalbr74 avatar May 19 '17 16:05 jalbr74

Worked here for warnings with ng2-toastr when building angular-cli & webpack.

Thanks pal, been wasting hours trying to resolve.....

Moorzee avatar Oct 13 '17 09:10 Moorzee

Great, I think this can be closed then

aciccarello avatar Oct 13 '17 14:10 aciccarello