|
|
|
|
|
by ianjsikes
2577 days ago
|
|
1. The "index.js" thing is due to how module resolution is handled with CommonJS and ES modules. If you have a file at "./lib/index.js", then you can omit the "index.js" and just write "require('./lib')" from another file. 2. Not exactly. In JS, every file with an "import" or "export" statement somewhere is its own module. 3. You can write code like this for the browser. Most browsers support ES modules now. However, you do need a bundler tool like Webpack if your code depends on other node modules. |
|