I recently attempted to utilize the npm package found at https://github.com/nefe/number-precision. However, despite following the prescribed steps, I encountered some difficulties.
After running
, I tried importing NP from 'number-precision' in my JS file first-line. Unfortunately, I received error messages such as "Cannot define require && export" or "Cannot use import statement outside a module."npm install number-precision --save--dep
I also attempted including
in my HTML file. Although no error message appeared, the NP method still did not function in my JS file.<script src="node_modules/number-precision/build/index.iife.js">import NP from 'number-precision </script>
I then added
and specified<script src="/workout.js"></script>
on the first line of my JS file. This resulted in an error message stating: "refused to execute script from 'http://0.0.0.0:2000/node_modules/number-precision/' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled." How can I properly implement this npm package in my JS file?import NP from 'number-precision'