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

Live Reloading Frontend Asset in Development & Optimize Webpack Recompile #140

Merged
merged 2 commits into from
Oct 17, 2020

Conversation

user512
Copy link
Contributor

@user512 user512 commented Oct 17, 2020

74f53ef provide live reload and compile frontend asset on JS / SCSS file change instead of waiting for a new request in development mode.

fbb02df optimize webpack recompile so recompile time is down to around 1 second.
Before fbb02df, making changes in any scss file that uses @apply

ℹ 「wdm」: Compiling...
ℹ 「wdm」: Hash: afed0a07af075545d568
Version: webpack 4.44.1
Time: 9598ms

After fbb02df

ℹ 「wdm」: Compiling...
ℹ 「wdm」: Hash: ead83387e0a910303855
Version: webpack 4.44.1
Time: 751ms

Please note that initial compile will still be slow but it'll be fine because developer only run bin/run once.

@user512 user512 temporarily deployed to convene-pr-140 October 17, 2020 13:19 Inactive
@user512 user512 requested a review from a team October 17, 2020 13:19
This changes reduce slow webpack compilation when using Tailwind @apply
Before this changes, it takes 10 seconds to recompile whenever change is made on application.scss
According to the ref articale, Tailwind CSS's components and utilites have large file sizes,
making the recompilation very slow.
This workaround separate Tailwind CSS and custom @apply CSS so webpack never have to recompile
the large Tailwind CSS stuff since it wasn't changed.

Ref: https://rubyyagi.com/solve-slow-webpack-compilation/
Another workaround, similar idea but without using @layer:
tailwindlabs/tailwindcss#443 (comment)
@user512 user512 temporarily deployed to convene-pr-140 October 17, 2020 13:46 Inactive
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.

Bug C 5 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@user512
Copy link
Contributor Author

user512 commented Oct 17, 2020

@anaulin @zspencer, this will make our frontend development happier. 😄

@user512 user512 changed the title Live Reloading Frontend Asset in Development Live Reloading Frontend Asset in Development & Optimize Webpack Recompile Oct 17, 2020
@user512
Copy link
Contributor Author

user512 commented Oct 17, 2020

I am going to merge this so it's easier for me to work on #139 but happy to change/ revert if you see red flag.

@user512 user512 merged commit ef17e3b into development Oct 17, 2020
@user512 user512 deleted the live-reloading-frontend branch October 17, 2020 14:16
@zspencer
Copy link
Member

Ah, that's super interesting! I've never used @layer before!

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

Successfully merging this pull request may close these issues.

2 participants