Fix the function of judging the commonJS environment

Add the environment test code for commonJS to avoid to some problem.