npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

How to make an import works in js file

Environment: VS Code.
I have a tester.js as following:
“use strict”;
import without from ‘lodash’;
function Tester ()
{
// var output = without([1, 2, 3], 1);
// console.log(output);
console.log(“tester is called!”);
}
in a html file, I have
< script src=“tester.js”> < /script>
< scrip t>
var tester = new Tester();
< /script>

The run will shows error:
ReferenceError: Tester is not defined

If I comment out the import line in tester.js, I got correct print out: tester is called!


(This isn’t about npm so I have moved to #community:javascript. Good luck with answers!)