Make es5.js the main file of the package

fixes #239
pull/241/head
Denis Demchenko 6 years ago
parent 2b6a63d088
commit 8e919efd4f

@ -26,15 +26,14 @@ First of all, require the library:
const bowser = require('bowser'); const bowser = require('bowser');
``` ```
By default, `require('bowser')` requires the *ES6 version of files*, which By default, `require('bowser')` requires the *ES5 version of files*, which
**do not** include any polyfills. **do not** include any polyfills.
In case if you don't use your own `babel-polyfill` you may need to have pre-built bundle with all needed polyfills. In case if you don't use your own `babel-polyfill` you may need to have pre-built bundle with all needed polyfills.
So, for you it's suitable to require bowser like this: `require('bowser/bundled')`. So, for you it's suitable to require bowser like this: `require('bowser/bundled')`.
As the result, you get a ES5 version of bowser with `babel-polyfill` bundled together. As the result, you get a ES5 version of bowser with `babel-polyfill` bundled together.
If you use bowser for Node.js, you'd better use `require('bowser/es5')`, You may need to use the source files, so they will be available in the package as well.
since source files have `import` statements, which are not compatible with Node.js yet.
## Browser props detection ## Browser props detection

@ -20,7 +20,7 @@
"url": "http://twitter.com/lancedikson" "url": "http://twitter.com/lancedikson"
} }
], ],
"main": "src/bowser.js", "main": "es5.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/lancedikson/bowser.git" "url": "git+https://github.com/lancedikson/bowser.git"

Loading…
Cancel
Save