eugeneware / eugeneware/deglobalify
Allow export mappings outside of `require` calls
- Dominant language
- JavaScript
- Stars
- 55
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
It would be neat if we could declare the export mappings outside the `require` calls, e.g.
``` js
//file: /public/scripts/app.js
var domready = require('domready') // regular npm module
, badmodule = require('./vendor/badmodule.js'); // returns an exports object
domready(function () {
console.log(badmodule.myfunc()); // prints 42
});
```
``` js
//file: package.json
deglobalify:{
'./vendor/badmodule.js': ['myfunc']
}
```
The advantage would be that your `require`s stay clean and if `badmodule` gets updated to be commonjs-compatible you don't have to change any of your require calls, only the `deglobalify` config inside `package.json`
Contributor guide
No contributing guide indexed for this repository
Research direction
Read /public/scripts/app.js and package.json first, then trace how deglobalify currently receives export mappings. Done means the mapping can be declared in package.json while the require call remains unchanged, and badmodule.myfunc() works as shown in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100