Economy-Bot icon indicating copy to clipboard operation
Economy-Bot copied to clipboard

parse-ms does not work with require()

Open dionsyran2 opened this issue 3 years ago • 3 comments

Hello, I realized that parse-ms cannot be included with require() As i get this error

import parseMilliseconds from 'parse-ms' ^^^^^^

SyntaxError: Cannot use import statement outside a module

Thats why i used the source code from parse-ms to create parse-ms-2, https://www.npmjs.com/package/parse-ms-2 All the source is in github (https://github.com/dionsyran2/parse-ms-2), so you can have a look and make sure i am not giving you a virus or something.

Thanks for reading

Have a nice day, dionsyran2

dionsyran2 avatar Aug 02 '21 17:08 dionsyran2

Hey! Change require to import and i find it works just fine!

LoopyChimp avatar Aug 31 '21 20:08 LoopyChimp

Hey! Change require to import and i find it works just fine!

only that you need to change my project to module to use import, but if i do i cannot use require or import other modules, because they only work with require()

dionsyran2 avatar Sep 01 '21 13:09 dionsyran2

hmm, sometimes it doesnt require you to have require for all of them, i changed all my requires to import. clone your files to a new folder and try that.

LoopyChimp avatar Sep 14 '21 16:09 LoopyChimp