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

Two modules with same relative name cause getBundles to return duplicate entries #7

Closed
tomkelsey opened this issue Oct 30, 2018 · 1 comment
Assignees
Labels
enhancement Enhancement or quest

Comments

@tomkelsey
Copy link

Expected Behavior

Calling getBundles should only return a specific chunk once.

Current Behavior

Using the build in example, getBundles returns:

Bundles:  { js: 
   [ { file: 'index.js',
       hash: '8f79901c42dd94f639f2',
       publicPath: '/dist/index.js' },
     { file: 'header.chunk.js',
       hash: '65a54ba3e1a237af26f6',
       publicPath: '/dist/header.chunk.js' },
     { file: 'content.chunk.js',
       hash: 'ff806ccb9f861560a980',
       publicPath: '/dist/content.chunk.js' },
     { file: 'content-nested.chunk.js',
       hash: 'ea831f89529ab7fd0acd',
       publicPath: '/dist/content-nested.chunk.js' },
     { file: 'multilevel.chunk.js',
       hash: '397037a9c96fb38bce9c',
       publicPath: '/dist/multilevel.chunk.js' },
     { file: 'shared-multilevel.chunk.js',
       hash: '7e0c20e6d0612b573cf5',
       publicPath: '/dist/shared-multilevel.chunk.js' },
     { file: 'shared-multilevel.chunk.js',
       hash: '7e0c20e6d0612b573cf5',
       publicPath: '/dist/shared-multilevel.chunk.js' },
     { file: 'deeplevel.chunk.js',
       hash: 'd10a8161e8b0e381d8c4',
       publicPath: '/dist/deeplevel.chunk.js' },
     { file: 'shared-multilevel.chunk.js',
       hash: '7e0c20e6d0612b573cf5',
       publicPath: '/dist/shared-multilevel.chunk.js' },
     { file: 'shared-multilevel.chunk.js',
       hash: '7e0c20e6d0612b573cf5',
       publicPath: '/dist/shared-multilevel.chunk.js' } ] }

You can see shared-multilevel.chunk.js is included multiple times.

This results in duplicate entries when outputting the script tag:

<script src="/dist/index.js"></script>
<script src="/dist/header.chunk.js"></script>
<script src="/dist/content.chunk.js"></script>
<script src="/dist/content-nested.chunk.js"></script>
<script src="/dist/multilevel.chunk.js"></script>
<script src="/dist/shared-multilevel.chunk.js"></script>
<script src="/dist/shared-multilevel.chunk.js"></script>
<script src="/dist/deeplevel.chunk.js"></script>
<script src="/dist/shared-multilevel.chunk.js"></script>
<script src="/dist/shared-multilevel.chunk.js"></script>

Possible Solution

I guess you need to check if the file already exists before adding into that file type's array?

Steps to Reproduce

Run the example, inspect the source

Other Comments

Apologies this looks like an unforeseen side effect of my suggested fix for #5!

@themgoncalves themgoncalves added the enhancement Enhancement or quest label Oct 30, 2018
@themgoncalves themgoncalves self-assigned this Oct 30, 2018
@themgoncalves
Copy link
Owner

I'm already working on this issue 😄

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

No branches or pull requests

2 participants