Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore webpack as replacement for browserify #53

Closed
lance opened this issue Apr 10, 2017 · 7 comments
Closed

Explore webpack as replacement for browserify #53

lance opened this issue Apr 10, 2017 · 7 comments

Comments

@lance
Copy link
Member

lance commented Apr 10, 2017

Currently we're generating a browser based version using browserify. Is webpack the new thing?

@helio-frota
Copy link
Member

Note: Focusing on the opossum's context only.

webpack

  1. "never tries to actually be compatible with node.js
  2. "It is built, from the ground up, to help you manage static assets for the front-end"
  3. "brings more features and puts them in core"
  4. "will always require some configuration to work for anything but the most basic case"
  5. Install size (including dependencies):
[hf@t440 fooing]$ cat package.json 
{
  "name": "fooing",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "webpack": "^3.0.0"
  }
}
[hf@t440 fooing]$ npm install

> fsevents@1.1.2 install /home/hf/dev/fooing/node_modules/fsevents
> node install


> uglifyjs-webpack-plugin@0.4.6 postinstall /home/hf/dev/fooing/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN fooing@1.0.0 No description
npm WARN fooing@1.0.0 No repository field.

added 342 packages in 10.573s
[hf@t440 fooing]$ du -s -h node_modules/
39M	node_modules/

browserify

  1. "was born to make your Node code in the browser."
  2. "expects to be used only in a Node.js project"
  3. "is a smaller more ‘modular’ tool"
  4. "is much more likely to work with minimal configuration but will force you into a small set of conventions"
  5. Install size (including dependencies):
[hf@t440 fooing]$ cat package.json 
{
  "name": "fooing",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "browserify": "^14.4.0"
  }
}
[hf@t440 fooing]$ npm install
npm WARN fooing@1.0.0 No description
npm WARN fooing@1.0.0 No repository field.

added 131 packages in 2.199s
[hf@t440 fooing]$ du -s -h node_modules/
15M	node_modules/

random:

If however, you’re predominantly dependent on the NPM ecosystem and you want a tool with a small and very well designed API and takes minimal configuration, you should go for Browserify. It doesn’t have all the features of Webpack, but it does have most, and it’s very easy to get started with.

@helio-frota
Copy link
Member

+1 to keep browserify

@lance lance closed this as completed Jun 28, 2017
@ghost ghost removed the in progress label Jun 28, 2017
@lance lance reopened this Dec 14, 2017
@lance
Copy link
Member Author

lance commented Dec 14, 2017

Reopening, as I do believe webpack is the way to go after having read and heard more.

@ghost ghost assigned lance Dec 14, 2017
@ghost ghost added the in progress label Dec 14, 2017
@lance
Copy link
Member Author

lance commented Dec 14, 2017

Very simple changes so far (https://github.com/bucharest-gold/opossum/compare/53-webpack). For some reason, webpack is barfing on the test suite, so I'm not sure what we should do about that. It also barfs when having it output a compressed file. This, I think, is because it's using UglifyJS which cannot deal with certain ES6 syntax. Maybe this is related.

@lance lance added ready and removed in progress labels Jan 10, 2018
@lance lance removed their assignment Feb 19, 2018
@helio-frota
Copy link
Member

@lance is really necessary to have both exploded opossum.js and compressed opossum.min.js ?

using escompress :

-rw-rw-r--. 1 hf hf  92687 Feb 21 16:58 opossum-min.js

plus extra build steps on package.json and Makefile

using babel-minify-webpack-plugin (20K smaller but only min version on dist folder):

-rw-rw-r--. 1 hf hf 72342 Feb 21 16:25 opossum.js

plus a require() and a plugin on webpack.config

@lance
Copy link
Member Author

lance commented Feb 21, 2018

@helio-frota I can live with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants