Use the Development Build option while developing your game. Reopen your project, and switch the target platform under File > Build Settings.
In the new dialog box, scroll down to find WebGL Build Support, select it, and click Done.
Find the install in the Unity Hub, click the Settings icon, and choose Add modules. To deploy on the WebGL platform, you first need to add the WebGL module to the Unity Editor to create a WebGL build.