2.0.21 • Published 2 years ago
xms-npm-learn v2.0.21
npm-learn
npm发布包练习,支持打包成多种格式
使用
npm安装
npm install xms-npm-learn --save-dev
浏览器直接引入
如果是采用直接引入的方式使用,可以在github下载包, 参考包中的./examples/browser/index.html的使用方式
<script type='text/javascript' src='./xms-npm-learn.js'></script>
调用
调用方式可以参考examples中的示例,有提供es6、node、browser等使用方式
node
let xmsLearn = require('./xms-npm-learn.js')
console.log(xmsLearn.default)
console.log(xmsLearn.default.name)
console.log(xmsLearn.default.say())
es6
import xmsNpmLearn from './xms-npm-learn'
console.log(xmsNpmLearn.name)
console.log(xmsNpmLearn.say())
browser
document.getElementById('root').innerHTML = " This is a browser example where and api is called to transalate" +
" 'One' to '1' \n Results: wordtonum('One') === "
+ xmsNpmLearn.default.name + ",say:" +xmsNpmLearn.default.say();
测试
node
可以使用node命令直接运行examples/node里的示例,
node ./examples/node/index.js
es6
注意,测试es6示例时,不能直接使用node命令,因为node命令不能识别import, 需要先安装babel-cli,当然,如果你是下载包执行npm install,已经自行安装了。
babel-node ./examples/es6/index.js
*如果运行报错,最好是全局安装babel-cli
npm install babel-cli -g
2.0.22
2 years ago
2.0.21
2 years ago
2.0.20
3 years ago
2.0.19
3 years ago
2.0.18
3 years ago
2.0.17
3 years ago
2.0.13
3 years ago
2.0.11
3 years ago
2.0.12
3 years ago
2.0.9
3 years ago
2.0.10
3 years ago
2.0.8
3 years ago
2.0.7
3 years ago
2.0.6
3 years ago
2.0.3
3 years ago
2.0.5
3 years ago
2.0.4
3 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.1.0
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago