console.js is a small javascript library, fix console is undefined, like html5shim and reset.css.
In ie6 ie7,console is undefined. In ie8 ie9, first open the developer tools before, console is undefined.
Migration to https://github.com/jsmini/console
Download and install through the npm
$ npm install --save @yanhaijing/console_js
If you are use webpack
import { polyfill } from '@yanhaijing/console_js';
polyfill(); // polyfill console undefined
If you are use requirejs
requirejs(['node_modules/@yanhaijing/console_js/dist/index.aio.js'], function (console_js) {
var polyfill = console_js.polyfill;
polyfill(); // polyfill console undefined
})
If you are use browser
<script src="node_modules/@yanhaijing/console_js/dist/index.aio.js"></script>
<script>
var polyfill = console_js.polyfill;
polyfill(); // polyfill console undefined
</script>
The first run requires installation of dependencies
$ npm install
Build code
$ npm run build
Run unit test, the browser environment requires manual test, in test/browser
$ npm test
Update package.json version,update README.md version,update CHANGELOG.md,then release
$ npm run release
Push to npm
$ npm publish --access=public
You may need to modify it as follows:
- README.md
- package.json
- config/rollup.js
- test/browser/index.html