Category Archives: JavaScript

Microtask vs Macrotask

Microtasks & Macrotasks are parts of big queue in event Loop what always works and listen the browser.

Makrotask are tasks which preformed by Javascript Event Loop engine. Such as script execution, events handling (mouseover,click, onkeypress ..) async functions like setTimeout.

Microtasks are tasks created by Promises and executing with .then/catch/finally methods.

And the winner is Microtasks It will be executed immediately after Macrotask.

JavaScript export/import ways

There’s 3 way to do it, all have a difference.

Named Export/Import (example)

//File where are You export some variable
export const name ='some string value';

//File where are You Import
import {name} from "..."

Mandatory :

In Export Module File after word “export” should be name of variable; (without name of variable you will get error, because it’s Named Export – so there should be name!

In Import file after word “import” should be curly braces it´s point out that You want to import exactly that variable name from source ‘…’

‘…’ (three dots) should be the path to file, it’s used just for example, in Your case it will be the path to directory where Your file has been saved for exp. “./Folder/fileName”

Continue reading

VueJs/Webpack : Loading chunk files failed

If you are using vuejs app in nested folder and you have chunked files – probably you could get this error:

Error: Loading CSS chunk chunk-4f730675 failed.
(css/chunk-4f730675.ba84c417.css)
at HTMLLinkElement.i..i..n..e.push.i..h.onerror

It could be css or js chunk files

Error causing in webpack/bootstrap script in production build.

To solve this problem we need to understand:

Why script try to load chunk files with async request? Why we have chunk files?

Because You used Grouping Components in the Same Chunk by Vue Router

so for solving this issue – you shouldn’t use this approach!

Grouping Components in the Same Chunk

Can we disable chunk files?

Just fix your Routes, using this approach to build your routes: