Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins can cause duplicate entries in records files #2777

Closed
ojacobson opened this issue Jul 16, 2016 · 3 comments
Closed

Plugins can cause duplicate entries in records files #2777

ojacobson opened this issue Jul 16, 2016 · 3 comments

Comments

@ojacobson
Copy link

ojacobson commented Jul 16, 2016

Webpack version: 1.13.0

Please tell us about your environment: Mac OS 10.11.mumble, Node v6.2.2

Current behavior:

When running webpack (npm run webpack) in this project, Webpack adds new entries to webpack-records.json, even though there are no code changes. Every run adds new records, causing the file to grow without bound.

Example diff:

diff --git a/webpack-records.json b/webpack-records.json
index da2c839..05569d8 100644
--- a/webpack-records.json
+++ b/webpack-records.json
@@ -13,6 +13,20 @@
         "byName": {},
         "byBlocks": {}
       }
+    },
+    {
+      "nextFreeModuleId": 2,
+      "modules": {
+        "byIdentifier": {
+          "node_modules/css-loader/index.js?sourceMap!src/app.css": 0,
+          "node_modules/css-loader/lib/css-base.js": 1
+        }
+      },
+      "nextFreeChunkId": 1,
+      "chunks": {
+        "byName": {},
+        "byBlocks": {}
+      }
     }
   ],
   "nextFreeModuleId": 4,

(The added records are identical to records already present in the file.)

The duplicate records appear in the section associated with the ExtractTextPlugin, but I've been able to reproduce this with other plugins, as well (including HtmlPlugin).

Expected/desired behavior:

  • Records files change only when modules are added to or removed from the bundle.
  • Duplicate sections do not appear in records files.
@TheLarkInn
Copy link
Member

Would you mind checking this in webpack@2?

@Jessidhia
Copy link
Member

Jessidhia commented Nov 24, 2016

This might be a problem with extract-text-webpack-plugin (or with child compiler handling), or at least I encountered a similar issue a few months ago with webpack@2.1.0-beta.21 + extract-text-webpack-plugin@2.1.0-beta.3.

On every build that used the recordsPath, the "extract-text-webpack-plugin" array in the records JSON would be appended with a new modules/chunks object.

This was a "disposable" project so I didn't pay it much mind, and I periodically delete the records anyway to re-optimize the chunk IDs.

sokra added a commit that referenced this issue Apr 13, 2017
This is a breaking change because plugins or loader could rely on this incorrect behavior
When using child compilations plugins and loaders should use a unique compiler name or use a consistent order

fixes #2777
@sokra sokra closed this as completed in 101850c Jun 5, 2017
@kisenka
Copy link
Contributor

kisenka commented Jun 5, 2017

@sokra does it mean that child compilation produce right HMR update files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants