create a bundle for commonjs, then run it in browser.
# from npm
npm install saber-commonjs -g
-
outFile: string, ...Files: string[]
Files[0] is main.
-
compile with a configFile 'commonjs.json',
for example:
{
"outFile": "./example/dist/bundle.js",
"main": "./example/js/main.js",
"include": ["./example"]
}
# install the typescript and webpack
npm install
# auto compile to commonjs
npm start
# auto compile to es5
npm run dev
Author: saber2pr
you should write ts in /src
ts -(tsc)-> commonjs -(webpack)-> es5
you should make test in /src/test
export your core in /src/index.ts!
Before publish, there are some items in package.json should to be updated below:
- name
- version
- description
- repository(url)
- author
# if all is well, try:
npm publish