1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Make es5.js the main file of the package

fixes #239
This commit is contained in:
Denis Demchenko 2018-08-02 21:36:41 +03:00
parent 2b6a63d088
commit 8e919efd4f
2 changed files with 3 additions and 4 deletions

View File

@ -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

View File

@ -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"