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.

Linting slowing build step by a lot

See original GitHub issue

Describe the issue

Currently, linting is part of the webpack build step using eslint-loader and it greatly slows the build process.

To clear the caches for simulating cold build

  1. rm -rf .cache-loader
  2. rm -rf node_modules/.cache

To Profile

Steps for setting up accurate profiling (on development):

  1. Install speed-measure-webpack-plugin as dev dependency
  2. Wrap merged webpack config with the plugin in webpack.config.dev.js like so:
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
const smp = new SpeedMeasurePlugin();

const developmentConfig = smp.wrap(merge([ /* ... */ ]));
  1. Disable parallelism in webpack config:
const developmentConfig = smp.wrap(merge([
  parts.setFreeVariable('process.env.NODE_ENV', 'development'),
  parts.setFreeVariable('process.env.DEBUG_WORKBOX', process.env.DEBUG_WORKBOX),
  commonConfig,
  {
    /* ... */
    parallelism: 1, // <-- here
    /* ... */
  }
]));
  1. To test with/without linting step, simply comment/uncomment this code block in webpack.config.common.js:
  // parts.lintJavaScript({
  //   include: parts.PATHS.app,
  // }),

Expected behavior

The build is 45% faster without the eslint-loader build step.

Profiling results

imgonline-com-ua-twotoone-axo45ub9oppfu

Left: with linting step Right: without linting step

Additional context

Profiled on branch https://github.com/nusmodifications/nusmods/tree/webpack-4.1/www

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ZhangYiJiangcommented, Oct 24, 2018

This is now implemented via #1052. I removed lint and type checks from the production Webpack config - in CI, those are ran in separate stages, and our deployment process is semi-automated, so all code that’s pushed into production should already have those checks run, which means rerunning them is a waste of time.

For development, Flow, ESLint and Stylelint are run by default, but can be disabled via env variables DISABLE_FLOW, DISABLE_ESLINT and DISABLE_STYLELINT. We make no assumption about the user’s editor, so by default these are enabled in case the user wants to use nano to write their code.

0reactions
ZhangYiJiangcommented, Oct 24, 2018

I still think we need eslint-loader for development, since not all editors support ESLint inline. Hot reload performance is the main concern for development, and I think it should still be acceptable right now.

How about we put it behind a flag that can be disabled by users with editors that have inline ESLint support ? @li-kai @taneliang

I’ve removed lintJavaScript from prod script in the Webpack 4 branch

Read more comments on GitHub >

github_iconTop Results From Across the Web

Super-Linter Build step feels slow · Issue #247 - GitHub
Hello! I've eagerly setup Super-Linter and found that it is by far slowest GitHub Action that I run against my PR. Build github/super-linter@v2....
Read more >
Lint Performance Tips - Google Groups
Lint tends to get slower for every release. There's a reason for that: It keeps checking more and more things (as of 3.3...
Read more >
A Complete Guide to Linting Go Programs - freshman.tech
This article demonstrates a comprehensive linting setup for Go projects, and discusses the best way to introduce it into an existing ...
Read more >
Angular project with eslint is super slow - Stack Overflow
Check the output for files that are actually not supposed to be part of the linting process (i.e. from node_modules folder or dist...
Read more >
Build Performance - webpack
This guide contains some useful tips for improving build/compilation performance. General. The following best practices should help, whether you're running ...
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