node.js - Do all npm packages need an export? -


i new nodejs packages , understood share code had module.export (in addition adding package.json)

for example bootstrap-select not have export function available on npm.

so question modules require export , can require('bootstrap-select') in code?

no, npm modules not require export. npm being used more not javascript packages intended use under node.js front end code browsers, css libraries, etc. @ least, npm package deliver payload of files not including javascript, such images, css, html, etc.

so can require('some-module') if package has either index.js file or has set main property in it's package.json file properly.

however if you authoring javascript module node.js, yes you'll need export in order module load properly.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -