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

Required namespace never provided for any of node_modules since 20170626 #2671

Closed
dmitrysteblyuk opened this issue Oct 5, 2017 · 5 comments

Comments

@dmitrysteblyuk
Copy link

dmitrysteblyuk commented Oct 5, 2017

Everything's compiling fine in 20170521 version. Since 20170626 I've got 944 errors for every import from node_modules (local imports work fine). Here's the command I run:

java -jar C:\Workspace\Angular2Project\node_modules\google-closure-compiler\compiler.jar
 --language_in=ES6_STRICT
 --language_out=ES5
 --compilation_level=ADVANCED_OPTIMIZATIONS
 --variable_renaming_report=./tmp/variable_renaming_report
 --property_renaming_report=./tmp/property_renaming_report
 --warning_level=QUIET
 --rewrite_polyfills=false
 --process_common_js_modules=true
 --module_resolution=node
 --dependency_mode=STRICT

 --js_module_root=node_modules/@angular/core
 --js_module_root=node_modules/@angular/common
 --js_module_root=node_modules/@angular/platform-browser
 --js_module_root=node_modules/@angular/platform-browser/animations
 --js_module_root=node_modules/@angular/animations
 --js_module_root=node_modules/@angular/animations/browser
 --js_module_root=node_modules/@angular/forms
 --js_module_root=node_modules/@angular/http
 --js_module_root=node_modules/@angular/router
 --js_module_root=node_modules/@angular/cdk
 --js_module_root=node_modules/@angular/material

 --entry_point=./tmp/out-closure/src/main-aot

 --output_manifest=./tmp/manifest.MF
 --js_output_file=./public/built/main.bundle.js

 --js=node_modules/rxjs/**.js
 --js=!node_modules/rxjs/bundles/**.js
 --js=./node_modules/@angular/core/@angular/core.js
 --js=./node_modules/@angular/common/@angular/common.js
 --js=./node_modules/@angular/platform-browser/@angular/platform-browser.js
 --js=./node_modules/@angular/platform-browser/@angular/platform-browser/animations.js
 --js=./node_modules/@angular/forms/@angular/forms.js
 --js=./node_modules/@angular/http/@angular/http.js
 --js=./node_modules/@angular/router/@angular/router.js
 --js=./node_modules/@angular/animations/@angular/animations.js
 --js=./node_modules/@angular/animations/@angular/animations/browser.js
 --js=./node_modules/@angular/cdk/@angular/cdk.js
 --js=node_modules/@angular/cdk/@angular/cdk/**.js
 --js=./node_modules/@angular/material/@angular/material.js
 --js=node_modules/@angular/material/@angular/material/**.js
 --js=node_modules/ngx-cookie/**.js
 --js=!node_modules/ngx-cookie/bundles/**.js
 --js=tmp/out-closure/**.js

 --externs=./node_modules/zone.js/dist/zone_externs.js
 --externs=./scripts/closure-externs.js

And errors it throws all like this:

./tmp/out-closure/src/shared/order-pipes.module.js:2: ERROR - required "module$node_modules$rxjs$Observable" namespace never provided
import { Observable } from 'rxjs/Observable';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

./tmp/out-closure/src/app/app.component.js:1: ERROR - required "module$$angular$core" namespace never provided
import { Component, ChangeDetectionStrategy, ViewEncapsulation, NgZone } from '@angular/core';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@dmitrysteblyuk
Copy link
Author

dmitrysteblyuk commented Oct 5, 2017

First I though the issue was with js_module_root, but then I noticed that imports from any of node_modules fail, not only from @angular, which uses module roots.

@MatrixFrog
Copy link
Contributor

Try changing your imports to include the .js extension.

@dmitrysteblyuk
Copy link
Author

I had already .js for imports. I added extensions to entry points as well but it didn't help

@dmitrysteblyuk
Copy link
Author

By the way, I checked other projects which use closure compiler for angular (https://github.com/angular/closure-demo, https://github.com/mlaval/optimize-angular-app) and found the same issue there.

@ChadKillingsworth
Copy link
Collaborator

This is known and fixed by #2641

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

3 participants