question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"ng build --prod" Error when destructuring an array from namespace

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

I have this namespace


export namespace Anamespace {
  export const Components = [
    AComponent1,
    AComponent2
  ];
}

in another file a declared a module that uses the namespace above


@NgModule({
  declarations: [...Anamespace.Components],
  exports: [...Anamespace.Components]
})
export classe Amodule{}

when running “ng serve” everything works fine. But when running “ng build --prod” i get this error:

ERROR in Error during template compile of ‘Amodule’ Unsupported import syntax.

Environment


Angular version: ^5.2.11


Browser:
- [ x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: 6.11.3  
- Platform:   Linux

Others:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
frederikprijckcommented, Dec 27, 2018

@mcherb It looks like this is fixed with Ivy. Afaik Ivy isn’t released yet. So this would mean it’s not fixed in Angular 7 . You could try enabling Ivy and see how it works out for you, but I don’t think that’s recommended for production yet.

0reactions
angular-automatic-lock-bot[bot]commented, Mar 21, 2020

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript array destructuring assignment gives strange errors
It appears that the array destructuring assignment is being parsed as an array indexing operation applied to the previous statement.
Read more >
Overzealous Destructuring | Aleksandr Hovhannisyan
The first problem with destructuring is that it strips object properties of their namespace, making it harder to tell, at a glance, ...
Read more >
destructuring array es6 Code Example - Code Grepper
ng has unexpectedly closed (exit code 127). ... If 'router-outlet' is an Angular component, then verify that it is part of this module....
Read more >
Google TypeScript Style Guide
Tip: If you only need some of the elements from an array (or TypeScript tuple), you can insert extra commas in a destructuring...
Read more >
typeerror: cannot read properties of undefined jasmine - You.com ...
npm/logs/2018-10-16T054330433Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! awesome-seo@0.0.0 build:prod: npm run build:server:prod && npm run ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found