My question concerns an existing library that I wish to publish as an NPM module. The library is already in use, and currently require
d via the local file system.
How can I specify the root directory of my module's files?
If I have a structure like:
.
├── package.json
├── src
| ├── js
| └────── lib
| └───────── my
| └───────────── thing.js
| └───────────── that.js
How do I specify that the root of my module, and accessible files is src/js/lib/my/
?
I would like to use as follows from an outside project:
var thing = require('my/thing'),
that = require('my/that');
I saw the "files"
property in package.json, is this the right way to go?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…