To import an npm module in JavaScript, here’s what you need to do: ➊ First, create a file that can import the required npm module in the style of ES6. For example, module. exports = require('get-urls'); ➋ Then, to import the global nodes and builtins, produce a rollup config file. ➌ Finally, use the bundled file in the project that you are working on.