I'm creating a package to publish to npm.
Please help.
You should have a single package.json for your project, and it's meant to be published on NPM. The idea with devDependencies
is that they won't get installed when people install your package from NPM, as opposed to dependencies
, which do get installed.
For your package to work as expected, you need at least the main
field that points to your main JS file.
See the docs for package.json
for a list of available fields.
You should use package.json
in your directory.
Publish file you want with files
of package.json
,
choose your main file (file will call by require
) with main
of package.json
You should read npm package.json
Example: ( dist
is directory build by gulp
)
{
"name": "<your_module>",
"files": [
"dist",
"someFile.js"
],
"main": "dist/index.js",
...
}
With this way, you should add module build your module
to devDependencies
, module was called by your module
in dependencies
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.