Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Parcel Auto Clear Console

I use Parcel with config below for my project.

{
"name": "forkify",
"version": "1.0.0",
"description": "",
"default": "index.html",
"scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html"
},
"author": "",
"license": "MIT",
"devDependencies": {
    "@parcel/transformer-sass": "^2.7.0",
    "parcel": "^2.7.0"
}

}

When i type npm start and change code in js file then save it, my web auto reload but the Parcel clear my console.log(), how to prevent this behavior guys? Thanks.

like image 487
MinhSu - Justin Avatar asked Oct 27 '25 05:10

MinhSu - Justin


2 Answers

Add type="module" attribute to your script tag in your index.html file.

like image 172
ali Avatar answered Oct 29 '25 20:10

ali


In index.html where is your script delete defer and add type="module". Like this: <script type="module"src="src/js/controller.js"></script>

like image 41
Stevan Avatar answered Oct 29 '25 19:10

Stevan