Remove process.env.NODE_ENV
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Andrey Sitnik · committed by Andrey Sitnik · parent ee7dee3 · Browse files · 5 files·+3 added−49 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+3 added−49 removed
- other:+3 added−49 removed
Provenance
- Commit
368a6e7- Tree
d452b03- Author
Andrey Sitnik <andrey@sitnik.ru>- Committer
Andrey Sitnik <andrey@sitnik.ru>- Parent
ee7dee3
5 files changed+3 added−49 removed
modified:index.browser.js-28 removed
123456789101112131415161718192021222324252627282930313233678968 unmodified lines// This file replaces `index.js` in bundlers like webpack or Rollup,// according to `browser` config in `package.json`.
let { urlAlphabet } = require('./url-alphabet')
if (process.env.NODE_ENV !== 'production') { // All bundlers will remove this block in the production bundle. if ( typeof navigator !== 'undefined' && navigator.product === 'ReactNative' && typeof crypto === 'undefined' ) { throw new Error( 'React Native does not have a built-in secure random generator. ' + 'If you don’t need unpredictable IDs use `nanoid/non-secure`. ' + 'For secure IDs, import `react-native-get-random-values` ' + 'before Nano ID.' ) } if (typeof msCrypto !== 'undefined' && typeof crypto === 'undefined') { throw new Error( 'Import file with `if (!window.crypto) window.crypto = window.msCrypto`' + ' before importing Nano ID to fix IE 11 support' ) } if (typeof crypto === 'undefined') { throw new Error( 'Your browser does not have secure random generator. ' + 'If you don’t need unpredictable IDs, you can use nanoid/non-secure.' ) }}
let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))
let customRandom = (alphabet, defaultSize, getRandom) => { // First, a bitmask is necessary to generate the ID. The bitmask makes bytes68 unmodified linesmodified:README.id-ID.md+1 added-4 removed
311 unmodified lines312 ```313 314 ### Rollup315 316-Untuk Rollup, dibutuhkan [`@rollup/plugin-node-resolve`](https://github.com/rollup/plugins/tree/master/packages/node-resolve) untuk versi browser dan [`@rollup/plugin-replace`](https://github.com/rollup/plugins/tree/master/packages/replace) untuk menggantikan `process.env.NODE_ENV`.316+Untuk Rollup, dibutuhkan [`@rollup/plugin-node-resolve`](https://github.com/rollup/plugins/tree/master/packages/node-resolve) untuk versi browser.317 318 ```js319 plugins: [320 nodeResolve({321 browser: true322- }),323- replace({324- 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)322 })323 ]324 ```325 83 unmodified linesmodified:README.md+1 added-6 removed
403 unmodified lines404 405 ### Rollup406 407 For Rollup you will need [`@rollup/plugin-node-resolve`] to bundle browser version408-of this library and [`@rollup/plugin-replace`] to replace409-`process.env.NODE_ENV`:408+of this library.:409 410 ```js411 plugins: [412 nodeResolve({413 browser: true415- }),416- replace({417- 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)414 })415 ]416 ```417 418 [`@rollup/plugin-node-resolve`]: https://github.com/rollup/plugins/tree/master/packages/node-resolve423-[`@rollup/plugin-replace`]: https://github.com/rollup/plugins/tree/master/packages/replace419 420 421 ### PouchDB and CouchDB422 114 unmodified linesmodified:README.ru.md+1 added-6 removed
390 unmodified lines391 392 393 ### Rollup394 395-Для Rollup понадобятся плагины [`@rollup/plugin-node-resolve`]396-и [`@rollup/plugin-replace`].395+Для Rollup понадобятся плагины [`@rollup/plugin-node-resolve`].396 397 ```js398 plugins: [399 nodeResolve({400 browser: true402- }),403- replace({404- 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)401 })402 ]403 ```404 405 [`@rollup/plugin-node-resolve`]: https://github.com/rollup/plugins/tree/master/packages/node-resolve410-[`@rollup/plugin-replace`]: https://github.com/rollup/plugins/tree/master/packages/replace406 407 408 ### PouchDB и CouchDB409 112 unmodified linesmodified:README.zh-CN.md-5 removed
381 unmodified lines382 383 ### Rollup384 385 对于 Rollup 来说,你需要 [`@rollup/plugin-node-resolve`] 来绑定浏览器版本。386-除了这个库,还需要 [`@rollup/plugin-replace`] 来替换 `process.env.NODE_ENV`。386 387 ```js388 plugins: [389 nodeResolve({390 browser: true392- }),393- replace({394- 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)391 })392 ]393 ```394 395 [`@rollup/plugin-node-resolve`]: https://github.com/rollup/plugins/tree/master/packages/node-resolve400-[`@rollup/plugin-replace`]: https://github.com/rollup/plugins/tree/master/packages/replace396 397 398 ### PouchDB and CouchDB399 100 unmodified lines