From 8bcb5dcfce278fa82e7122d101931bfb23043fab Mon Sep 17 00:00:00 2001
From: Endi <endiliey@gmail.com>
Date: Fri, 25 Oct 2019 14:01:21 +0700
Subject: [PATCH] perf(v2): disable hash for css modules localident in dev
 (#1882)

* perf(v2): disable hash for css modules localident in dev

* changelog
---
 CHANGELOG-2.x.md                        | 1 +
 packages/docusaurus/src/webpack/base.ts | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG-2.x.md b/CHANGELOG-2.x.md
index a90659abeaf8..a422299a269f 100644
--- a/CHANGELOG-2.x.md
+++ b/CHANGELOG-2.x.md
@@ -7,6 +7,7 @@
 - Default PostCSS loader now only polyfills stage 3+ features (previously it was stage 2) like Create React App. Stage 2 CSS is considered relatively unstable and subject to change while Stage 3 features will likely become a standard. 
 - Fix search bar focus bug. When you put the focus on search input, previously the focus will remain although we have clicked to other area outside of the search input.
 - New themeConfig option `sidebarCollapsible`. It is on by default. If explicitly set to `false`, all doc items in sidebar is expanded. Otherwise, it will still be a collapsible sidebar.
+- Disable adding hashes to the generated class names of CSS modules in dev mode. Generating unique identifiers takes some time, which can be saved since including paths to files in class names is enough to avoid collisions.
 
 ## 2.0.0-alpha.30
 
diff --git a/packages/docusaurus/src/webpack/base.ts b/packages/docusaurus/src/webpack/base.ts
index 8bb749b7b42d..866071e858de 100644
--- a/packages/docusaurus/src/webpack/base.ts
+++ b/packages/docusaurus/src/webpack/base.ts
@@ -144,7 +144,9 @@ export function createBaseConfig(
           test: CSS_MODULE_REGEX,
           use: getStyleLoaders(isServer, {
             modules: {
-              localIdentName: `[local]_[hash:base64:4]`,
+              localIdentName: isProd
+                ? `[local]_[hash:base64:4]`
+                : `[local]_[path]`,
             },
             importLoaders: 1,
             sourceMap: !isProd,