Repository URL to install this package:
|
Version:
1.2.8 ▾
|

src code is es6 supported by LTS node & last many versions of chromemake, or make copy test cov prepublish)yarn run jest -- --coverage
src/ -> / copying the files to the root encourages much easier modular importssrc/ -> dist/test/ -> test-distdist/ & test-dist/ with sourceMaps inlined (output into those same respective dirs)UPDATE - migrated to jest!
--coveragerollup: config: {} entry in package.json for some targets that need a little extra configdist folder that is es3+, and we can use it for each target (vs transpiling all of the source code each time)amd – Asynchronous Module Definition, used with module loaders like RequireJScjs – CommonJS, suitable for Node and Browserify/Webpack/FuseBoxes (default) – Keep the bundle as an ES module fileiife – A self-executing function, suitable for inclusion as a tag. (If you want to - create a bundle for your application, you probably want to use this, because it leads to - smaller file sizes.) (preact builds with this)umd – Universal Module Definition, works as amd, cjs and iife all in one ❗ (this is default dev export, used also for dev by inferno)UPDATE
debugger to be used, so just importing from (or aliasing to) /debugger will enable that flowgzip-size dist/index.js --raw >> build/size-over-time.txtdate +%Y:%M:%D:%H:%M:%S >> build/size-over-time.txtecho --- >> build/size-over-time.txtmain export yet - but likely soonnode --version for "latest"some notes
main, browserjs:next, module replaces it{ "main:es6": "src/index.js", "main:dev": "dists/dev/index.js", "main:tsc": "dists/tsc/index.js", "main:iife": "dists/iife/index.js", "main:umd": "dists/umd/index.js", "main:cjs": "dists/cjs/index.js", "main:es": "dists/es/index.js", "js:next": "dists/es/index.js", "main": "dists/umd/index.js", "module": "dists/umd/index.js", "web": "dists/cjs/index.js", "browser": "dists/cjs/index.js", "alias": "dists/cjs/index.js", "amd": "dists/amd/index.js", "types": "typings/index.d.ts", "typings": "typings/index.d.ts" }
This is how replace/define plugin works:
Libraries (such as react, inferno, etc) (see react-readme, react-code, inferno-code) have conditionals which look like the following:
if (process.env.NODE_ENV === 'development') { /* do debugging */ }
After it has been run with a config similar to:
define({ 'process.env.NODE_ENV': JSON.stringify('production'), })
the library code will come out as
if ('production' === 'development') { /* do debugging */ }
when that code is run through uglify or babili with drop-dead-code (default: true), it can do static-analysis, and will remove that block, since 'production' is never 'development'.
since this is a string replacement, it does not mean that a process polyfill is required for the browser, so console.log(process.env) will not exist unless it is auto-polyfilled because of that console.log, or because you've explicitly added a polyfill that handles that.
the origin of define is C define
to see more on deadcode elimination
be careful - module.exports & exports.name work perfectly well, test your dist files