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.
Add type="module" attribute to your script tag in your index.html file.
In index.html where is your script delete defer and add type="module". Like this: <script type="module"src="src/js/controller.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With