title: Failed to create an optimized build
body: <p>I have been building a React.JS web app but after I run the build command &quot;npm run build&quot; It says</p>
  <p>&quot;Creating an optimized production build...
  Failed to compile.&quot; ,</p>
  <p>and after trying many solutions to correct it , It still occurs after running the command . also below it some more errors are occurring as -</p>
  <p>Line 37:9:  'checkValidServiceWorker' was used before it was defined<br />
  no-use-before-define</p>
  <p>Line 49:9:  'registerValidSW' was used before it was defined<br />
  no-use-before-define</p>
  <p>Line 59:7:  Assignment to property of function parameter 'registration'<br />
  no-param-reassign</p>
  <p>So , can anyone help me with these errors?</p>