packing-node-module
v1.0.1
Published
Packing npm node_modules or custome file to a commonjs bundle. Can be used with require-from-remote
Downloads
2
Maintainers
Readme
packing-node-module
Packing npm node_modules or custome file to a commonjs bundle
Can be used with require-from-remote
How To Use
API
const build = require('packing-node-module')
// packing npm node_modules ,the node_modules needs to be installed
const axiosStr = await build('axios')
// packing custome file
const myFileStr = await build('./myFile.js')
// packing by config
// see config support from https://webpack.js.org/configuration/
const axiosStr = await build('axios', {
mode: 'development',
})
CLI
Packing npm node_modules ,the node_modules needs to be installed :
npx pnm axios
Packing custome file :
npx pnm axios './myFile.js'
Export to File :
npx pnm 'axios' > axios.js
Packing by config :
npx pnm 'axios' './config.json'
see config support from https://webpack.js.org/configuration/
Use with require-from-remote
Use packing-node-module to package your module or code
Upload the code to your cdn or server
Use require-from-remote to require url