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.

[Breaking change] babel-loader => ts-loader in web build builder 8.5.0

See original GitHub issue

Please make sure you have read the submission guidelines before posting an issue

Expected Behavior

Being able to use all Typescript features.

Current Behavior

babel-loader doesn’t support all Typescript features, e.g., const enum, like ts-loader does.

Failure Information (for bugs)

ERROR in /path/to/file.ts
Module build failed (from /path/to/repo/node_modules/babel-loader/lib/index.js):
SyntaxError: /path/to/file.ts: 'const' enums are not supported.

See also https://github.com/babel/babel/issues/8741.

Steps to Reproduce

Just run a web project build that includes const enums.

Context

Please provide any relevant information about your setup:

Version of Nx used: 8.5.0

Relevant commit: https://github.com/nrwl/nx/commit/811c50b Relevant PR: https://github.com/nrwl/nx/pull/1792

Other

The below are other potential breaking changes that are related only in that they were done in the same commit/PR. Happy to move these into separate issues if preferable. In no particular order:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
jaysoocommented, Oct 17, 2019

@atifsyedali Hey, thanks for chiming in. I don’t think it’ll quite work with using transpileOnly since depending on what babel-plugins you use, it may not transpile using just tsc. I think we should be able to get support parity with prevous ts-loader setup.

0reactions
atifsyedalicommented, Oct 8, 2019

Our codebase broke wrt namespaces, const enums, decorators, and more.

@jaysoo Can’t we have the Typescript compiler in transpileOnly mode pipe output to Babel, with the option of disabling Babel altogether? Then in parallel use the ForkTsChecker plugin.

This may seem like it may make the builds slower, but ‘@babel/preset-typescript’ is already installed in babel, which you can now remove if you first pipe through tsc before babel.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript loader for webpack - ts-loader - npm
Start using ts-loader in your project by running `npm i ts-loader`. ... Faster Builds; Yarn Plug'n'Play; Babel; Parallelising Builds ...
Read more >
Changelog - Cypress Documentation
Read our Migration Guide which explains the breaking changes in more detail. ... The Cypress v10 introduction video will now be skipped if...
Read more >
babel-loader - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Error: Cannot resolve module 'babel-loader' - Stack Overflow
I think the issue was that the Babel-loader node package wasn't installed properly or the executable couldn't be located by the application.
Read more >
Build Standardized Applications with Webpack5 + React + TS ...
//_webpack.config.js_ ... rules: [ { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader', }, { test: /\.css$/, use: ['style-loader' ...
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