Skip to content
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

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

Open
jalbr74 opened this issue Mar 6, 2017 · 8 comments
Open

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

jalbr74 opened this issue Mar 6, 2017 · 8 comments

Comments

@jalbr74
Copy link

jalbr74 commented Mar 6, 2017

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!

@aciccarello
Copy link

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

@jalbr74
Copy link
Author

jalbr74 commented Mar 7, 2017

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

@artem-v-shamsutdinov
Copy link

Same here:

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

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

@kptLucek
Copy link

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

@Predhin
Copy link

Predhin commented May 19, 2017

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

@jalbr74
Copy link
Author

jalbr74 commented May 19, 2017

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:
angular-redux/store#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.

@Moorzee
Copy link

Moorzee commented Oct 13, 2017

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

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

@aciccarello
Copy link

Great, I think this can be closed then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants