# Configure Standalone Module Files
Each JS file in this `/misc` directory is intended to be referenced as an **individual, standalone JS package** on the front end. This requires a bit of setup. 

1. Add the **module name** into the list of `launchModules` inside `Gruntfile.js`:
```
const launchModules = ['Calculator', 'Carousel', 'PillId', 'Subscribe'];
```
2. Add the **module reference** into `package.json`:
```
"ddc-pillid": "./node_modules/@drugscom/ddcjsmodules/src/misc/pill-id",
```
3. Include the **module file** on any pages where needed:
```
$site->page->jsConfig->addDelayedScript('/js/module-pillid.js');
```

Optional: Add the **module file** to the `versionAssetsListSpecialKeysProvider` method inside `GruntTest.php` for unit testing:
```
$data[] = ['/bundle/js/module-pillid.min.js'];
```

### Notes

1. The module source code **must** contain a publicly accessible `init` method. This method can be an empty placeholder.
```
module.exports = {
    init: init
};
...
function init()
{
    // Do something on script startup
}
```
2. Both the **module reference** and the **module file** must be a **lowercase** version of the **module name** used inside `Gruntfile.js` (regardless of the original file name inside the `/misc` directory). For example:
```
Original file: /misc/pill-id.js
Module name: PillId
Module reference: "ddc-pillid"
Module file: /bundle/js/module-pillid.min.js
```
