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.

why runtime/chunk not processed by babel-loader?

See original GitHub issue

Bug report

What is the current behavior? contain es6 syntax array destruction image

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

// webpack.config.js
{
  test: /\.(js|jsx|ts|tsx)$/,
  exclude: [
    /node_modules[\/
    ]core-js/,
    /node_modules[\/
    ]webpack[\/
    ]buildin/,
  ],
  use: [
    {
          loader: 'babel-loader',
          options: {
              cacheDirectory: true
      }
    },
    {
          loader: 'ts-loader',
          options: {
              transpileOnly: true,
      },
    },
  ],
}
// babel.config.json
{
  "sourceType": "unambiguous",
  "presets": [
    [
      "@babel/preset-env",
      {
        "useBuiltIns": "usage",
        "modules": false,
        "loose": true,
        "corejs": {
          "version": "3",
          "proposals": true
        }
      }
    ],
    "@babel/preset-react"
  ]
}

What is the expected behavior? It should be like this image

Other relevant information: webpack version: 5.74.0 Node.js version: v16.16.0 Operating System: macOS Monterey 12.0.1 (21A559) Additional tools: -

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-akaitcommented, Aug 17, 2022

Yes, webpack doesn’t run babel loader on generated runtime, it will be very bad for perf and increase output, so we have these variables (and get them from browserslist for better DX)

1reaction
alexander-akaitcommented, Aug 17, 2022

Anyway if you want to say webpack don’t generate it you can use https://webpack.js.org/configuration/output/#outputenvironment and set destructuring to false

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimization - webpack
If you are using webpack CLI, the webpack process will not exit with an ... runtimeChunk to true or 'multiple' adds an additional...
Read more >
Webpack 4 chunking different runtime behaviour compared to ...
If you want to run two modules in order at an entrypoint, use an array. You should not use the vendor chunk as...
Read more >
React + Webpack 5 + Babel 7 IE11 issue -- not attaching to root
Issue: No matter what I do, I can't get anything inside my root div. There are no console errors at all in IE11....
Read more >
Webpack 4 in production: How to make your life easier
In our case, we are telling webpack to use babel-loader for all JS files that are not located in node_modules directory. This enables...
Read more >
Bundle optimization - Notes
cache/babel-loader or fallback to the default OS temporary file directory if no node_modules folder could be found in any root directory. Another useful ......
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