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.

App-shell devkit builder doesn't support ES6 imports

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [x] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node v10.11.0 npm 6.4.1 ng 7.1.2 macOS Mojave / High Sierra

Repro steps

  1. create a new project with CLI
  2. generate an app-shell with cli schematics ng generate app-shell --client-project shell-error --universal-project shell-error
  3. install an es6 lib npm install --save lodash-es
  4. add an import to an es6 lib (something from lodash-es in this case)
  5. run the app shell builder ng run shell-error:app-shell

The log given by the failure

Unexpected token export
/Users/camsden/shell-error/node_modules/lodash-es/lodash.js:10
export { default as add } from './add.js';
^^^^^^

SyntaxError: Unexpected token export
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.lodash-es (/Users/camsden/shell-error/dist/shell-error-server/main.js:625:18)
    at __webpack_require__ (/Users/camsden/shell-error/dist/shell-error-server/main.js:20:30)
    at Module../src/app/app-shell/app-shell.component.ts (/Users/camsden/shell-error/dist/shell-error-server/main.js:223:67)
    at __webpack_require__ (/Users/camsden/shell-error/dist/shell-error-server/main.js:20:30)
    at Module../src/app/app.server.module.ts (/Users/camsden/shell-error/dist/shell-error-server/main.js:423:88)
    at __webpack_require__ (/Users/camsden/shell-error/dist/shell-error-server/main.js:20:30)

Desired functionality

Should be able to build the app shell with es6 imports.

Mention any other details that might be useful

It looks like there might be a webpack loader or a build step missing for the app-shell builder. https://github.com/ca136/cli-shell-error

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
alexeaglecommented, Dec 13, 2018

We should bundle the third-party dependencies with webpack so that it transpiles the ESModule syntax

1reaction
alan-agius4commented, Dec 17, 2019

@phetw, in this case it doesn’t matter which component to render, as it will fail during parsing not execution.

Can someone please verify it this issue is still present in version 9? Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng g app-shell input.mergeMap is not a function - Stack Overflow
It seems that if you have @angular/cli installed globally and a different version installed locally it gets broken.
Read more >
Package Diff: @angular-devkit/build-angular @ 0.12.4 .. 0.13.5
Visual diff of the npm package '@angular-devkit/build-angular' comparing 0.12.4 with ... + WARNING: Zone.js does not support native async/await in ES2017.
Read more >
angular/angular-cli - Gitter
Hi, could be anybody give me a hand for: angular-cli ng build -prod , that cannot load service issue? import { RoleService }...
Read more >
Schematics for libraries - Angular
The following steps show you how to add initial support without modifying any ... import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; ...
Read more >
Errors: Data path “.builders['app-shell']” should have required ...
In your package.json change the devkit builder. ... lambda expression does not support in IE so we can replace with code function() instead...
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