Skip to content

Commit

Permalink
Remove "browser" version
Browse files Browse the repository at this point in the history
Ref #18

Since the problem with uglify is fixed there is not reason to keep
browser version which do not add any benefits. Actually it blocks us
from distributing `esm` version which is widely used these days and
supported by the most popular bundlers like webpack, rollup and parcel.

Here's a few links
facebook/fbjs#86 (comment)

Both uglify and babel minify support evaulation and eliminating

```js
(function () {
  function warning() {}

  var __DEV__ = 'production' !== 'production'

  if (__DEV__) {
    warning = function (msg) {
      console.log(msg)
    }
  }

  warning()
} ());
```

https://skalman.github.io/UglifyJS-online/

https://babeljs.io/repl#?babili=true&browsers=&build=&builtIns=false&code_lz=BQMwrgdgxgLglgewgAmASmQbwFDOeaeJZAdwEMAnCOCAc3SwF9tdkA3S5AfS4BEBRAGo9kAXmQByAA4UEAEzCxEECcgCEo8dNkKlSCSzxwQqHgOFcMOPHnJUatMfkh6UwALYBnWldY3kUEieCAA2AKYAdCEI9F4-fsjMeMysdtR06NiMqGhoANxAA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&lineWrap=false&presets=babili%2Cenv&prettier=false&targets=&version=6.26.0&envVersion=1.6.2
  • Loading branch information
TrySound authored and BerkeleyTrue committed May 22, 2018
1 parent 089d8b8 commit 2b3ba7f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 67 deletions.
62 changes: 0 additions & 62 deletions browser.js

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
"version": "3.0.0",
"description": "A mirror of Facebook's Warning",
"main": "warning.js",
"browser": "browser.js",
"browserify": {
"transform": [
"loose-envify"
]
},
"files": [
"browser.js",
"warning.js"
],
"scripts": {
Expand All @@ -21,7 +19,8 @@
},
"devDependencies": {
"browserify": "^11.0.1",
"tap": "^1.4.0"
"tap": "^1.4.0",
"uglify-js": "^3.3.25"
},
"repository": {
"type": "git",
Expand Down
6 changes: 4 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var browserify = require('browserify');
var test = require('tap').test;
var vm = require('vm');
var minify = require('uglify-js').minify;

var file = __dirname + '/package/' + process.env.NODE_ENV + '.js';

Expand All @@ -19,8 +20,9 @@ test('browserify', function(t) {
});
b.bundle(function(err, src) {
t.notOk(err);
t.notMatch(String(src), /\bprocess\.env\.NODE_ENV\b/);
t.notMatch(String(src), /__DEV__/);
var minified = minify(src).code
t.notMatch(String(minified), /\bprocess\.env\.NODE_ENV\b/);
t.notMatch(String(minified), /__DEV__/);
var c = {console: {}};
vm.runInNewContext(src, c);
c.package(t);
Expand Down

0 comments on commit 2b3ba7f

Please sign in to comment.