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.

webpack compiling twice on startup when importing a file within a typescript react setup

See original GitHub issue

Bug report

What is the current behavior?

Working on a TypeScript React project when running webpack the compilation happens twice at startup. This happens when a file is being imported from the root react index.tsx. Not sure if its similar to https://github.com/webpack/webpack/issues/13618?

If the current behavior is a bug, please provide the steps to reproduce.

  1. https://github.com/bahtou/issues/tree/webpack-rebuild
  2. follow the readme

you should be able to see two rebuilds

👀   1 . compilation afterEmit 2021-11-18T22:01:58.573Z
👀   1 . compilation is done 2021-11-18T22:01:58.575Z
👀   2 . compilation afterEmit 2021-11-18T22:01:58.872Z
👀   2 . compilation is done 2021-11-18T22:01:58.872Z

What is the expected behavior?

compilation should only run once

Other relevant information: webpack version: 5.64.1 Node.js version: v14.18.1 Operating System: OSX Additional tools: none

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sokracommented, Nov 20, 2021
1reaction
alexander-akaitcommented, Nov 19, 2021

Yep, it is bug

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compiling and bundling TypeScript libraries with Webpack
Since I started working on UI-Router React I've been enjoying writing TypeScript. There are both advantages and disadvantages working with a typed and ......
Read more >
Using webpack with TypeScript - LogRocket Blog
Learn how to use webpack to compile TypeScript to JavaScript and bundle source code into a single JavaScript file.
Read more >
Code splitting with webpack and TypeScript - Spencer Miskoviak
Photo by Brendon Thompson. Code splitting is an approach to break apart a single large file into many smaller files.
Read more >
Setting TypeScript For Modern React Projects Using Webpack
There are several ways to set up TypeScript in a React Project. In this tutorial, we'll be covering just two. Method 1: Create...
Read more >
Integrating TypeScript with Webpack | by Uday Hiwarale
When you compile this project, TypeScript has to run a full type analysis on all the .ts files included in the Webpack compilation...
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