JS modules are loaded twice
See original GitHub issueBug report
Describe the bug
JS modules seem to be loaded twice
To Reproduce
Steps to reproduce the behavior:
- Go to ‘https://www.nextjs.org’ (or your own built site)
- Click on ‘developer console’ in e.g. Chrome
- See Network tab
- Do a hard refresh (E.g. CTRL + SHIFT + R)
- Sort resources by name
- Look at loaded JS modules. They appear twice in the resource list, but are not retrieved from cache
Expected behavior
All required resources to be loaded just once.
Screenshots

System information
- OS: Ubuntu Linux
- Browser Chrome
- Version of Next.js: 9.1.1 - 9.3.0
Additional context
When disabling granular loading in next.js config, the issue seems resolved.
experimental: {
granularChunks: false,
css: false
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:24 (10 by maintainers)
Top Results From Across the Web
What Happens When a Module Is Imported Twice?
A JavaScript module is evaluated just once. When imported multiple times from the same path, the same module instance is returned.
Read more >Requiring the same module twice in Node.js - Stack Overflow
Importing the same thing multiple times should have no effect, because loaded modules are cached. · Require has a cache that basically imports ......
Read more >DOMContentLoaded twice - Questions - three.js forum
It appears that the importmap (es-module) shim causes document.DOMContentLoaded to be called twice. Why? For example, the following code ...
Read more >JavaScript modules for grumpy developers from 2005
Now what if we try loading our module twice, like this? const module1 = await import(url); const module2 = await import(url);. The browser...
Read more >What happens if I import the same module twice? - JS IQ
If multiple modules imports the same module then angular evaluates it only once (When it encounters the module first time). It follows this...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @Timer ,
I still can reproduce this issue on a lot of sites, including nextjs.org
Could you, please, clarify this behaviour? Is it expected?
We’re seeing the same behavior as well on the latest version of Next.js 10.0.6