I have created the sample spfx solution and uploaded it into the app catalog and i have added it to the site page. if I am changing in the local code and if I run the gulp serve the actual changes are reflecting in the SharePoint pages also. how is this possible. anyone please explain the process.
You probably ran the gulp tasks for bundling and packaging without the "--ship" flag at the end, so it still connects to your localhost after deployment
If you open the
<your-webpart-guid>.manifest.json from the
\dist folder, you will notice that the internalModuleBaseUrls property in the loaderConfig entry still refers to your local computer:
"internalModuleBaseUrls": [ "https://`your-local-machine-name`:4321/" ]
You can find more detail here.