-
-
Notifications
You must be signed in to change notification settings - Fork 512
Duplication in bundle output using skeleton-typescript-webpack (duplicated modules) #894
Comments
Here are is the webpack output when
After importing bootstrap in main.ts
Notice that the app bundle is now bigger. Whether bootstrap is imported in main.ts or not, commenting out |
@EisenbergEffect @chrisckc I can help fix this, if the skeletons are still supported officially. Probably will need to upgrade webpack to v4 too |
Looks like this guy's issue was caused by this too: |
@chrisckc Your config looks nice. Would be awesome if you could create a PR to update the skeletons, if @EisenbergEffect can confirm that we want to maintain them. |
I'd like to replace our current skeletons by output from the CLI for standard configs so that we have one source of truth. However, if we aren't quite able to do that with the CLI yet, then we should fix the skeletons. @JeroenVinke can you provide me with a quick update on where we're at with that? |
Someone was working on the feature but development stopped due to a personal situation. I’ll pick it back up again starting this weekend. I believe it was almost done. We’d have to add support for auto trace though, since that didn’t exist when work on the feature started |
Thanks for looking into this @JeroenVinke Let me know what you think it will take to get us there once you have a chance to assess things. |
@JeroenVinke when you refer to "the feature" do you mean the ability for the CLI to replace the skeletons by updating the CLI to generate the same sample source files (nav-bar.html, welcome.ts, users.ts etc.) as contained in the skeletons? In the meantime i think it would be worth updating both the skeletons and the CLI, i will submit a PR for this on the CLI as requested by @EisenbergEffect. I could also do the same for the webpack skeleton if you like? |
I'm submitting a bug report
skeleton-typescript-webpack
same as current skeleton-typescript-webpack
Please tell us about your environment:
MacOS
8.11.4
6.4.1
Current behavior:
Clone this repo and go to skeleton-typescript-webpack
Inside main.ts, add the line
import 'bootstrap
(importing bootstrap is required to allow the bootstrap jQuery extensions to be used in code such as .collapse() etc.)
Run
npm start
and check bundle contents, notice that the vendor and app bundles now both contain jQuery.Notice an issue this causes, shrink your browser width so that the hamburger menu kicks in, notice that the hamburger button expands the menu but is no longer able to hide the menu. (this worked before)
I noticed this issue because i wanted to make the hamburger menu collapse after selecting a menu item, which is does not do in skeleton-typescript-webpack. I import bootstrap in main.ts then created a nav-menu.ts file. I added the some jQuery code to nav-menu.ts to make the collapsed menu hide when clicking a menu item. I then noticed that the menu was now broken as it did not hide when clicking the hamburger button. Note that there is another way to do this by adding
data-toggle="collapse"
to theThe issue is caused by the duplication of jQuery across both the vendor and app bundles, if you check the bundles after adding
import 'bootstrap
, you will notice huge bloat in the app bundle and jQuery existing in both bundles.jQuery is duplicated along with bootstrap and bluebird due to the use of the following line in webpack.config.js under the
entry
property:vendor: ['bluebird', 'jquery', 'bootstrap'],
commenting out that line fixes the issue as it allows webpack to sort out the dependancies properly.
Note that this issue also occurs using webpack v4 and the webpack config generated by the Aurelia CLI.
Note that commenting out this line results in no vendor bundle being generated and everything being in the app bundle, i believe that for webpack v3, the CommonsChunkPlugin is required to fix that.
Expected/desired behavior:
Adding
import 'bootstrap
should not break the nav-menu. It should not cause duplication of jQuery.The webpack config in the skeleton should be correct and allow bootstrap query extensions to be used without causing duplication of jquery bootstrap and bluebird across the vendor and app bundles.
To provide better quality app skeletons for Aurelia devs to use as starting point for projects. To reduce the frustration caused when devs try to do simple things from the app skeleton and find it doesn't work as expected, making them less likely to drop Aurelia in favour of some other popular SPA framework...
The text was updated successfully, but these errors were encountered: