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.

Module build failed (from ../../node_modules/@nrwl/web/src/utils/web-babel-loader.js)

See original GitHub issue

Current Behavior

Babel is not compiling TS. I get the following error when trying to run npx nx serve app:

ERROR in ../event-emitter/src/lib/event-emitter.ts
Module build failed (from ../../node_modules/@nrwl/web/src/utils/web-babel-loader.js):
SyntaxError: /Users/andy/dev/nx-test/packages/event-emitter/src/lib/event-emitter.ts: Unexpected token, expected "(" (6:34)

  4 |  * Create an event emitter.
  5 |  */
> 6 | export function createEventEmitter<
    |                                   ^
  7 |   T extends Record<string, unknown>
  8 | >(): EventEmitter<T> {

Expected Behavior

TS syntax should be recognised correctly.

Steps to Reproduce

Here is a minimal repository: https://github.com/andyjessop/nx-test

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

8reactions
andyjessopcommented, Feb 9, 2022

I just added a .babelrc into each of my package root directories with these contents:

{
  "presets": ["@nrwl/web/babel"]
}

0reactions
github-actions[bot]commented, Oct 10, 2022

This issue has been automatically marked as stale because it hasn’t had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask Question
main.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-es2015' from ...
Read more >
Bug Report
Bug Report Current Behavior when i try to run the command npm start i get that error : ERROR in ./main.js Module build...
Read more >
Angular
Error : Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): · delete the node_modules folder · delete package-lock.json ...
Read more >
Get Help and Help Others
Compiled with problems:X ERROR in ./src/components/Button/Button.tsx Module build failed (from ../node_modules/babel-loader/lib/index.js):.
Read more >
Sign in - YouTube
Module build failed (from ./node_modules/source-map-loader/dist/cjs. js ): Error: ENOENT: no such file or directory, ...
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