Skip to content

Instantly share code, notes, and snippets.

@markmarijnissen
Last active August 29, 2015 14:04
Show Gist options
  • Save markmarijnissen/be10f38cfcd477d8aec7 to your computer and use it in GitHub Desktop.
Save markmarijnissen/be10f38cfcd477d8aec7 to your computer and use it in GitHub Desktop.
Webpack notes

Config requirements

  • Require jade, coffee,less
  • cordova.js should be loaded externally
  • Copy file assets (png,jpg,ttf,etc) rather than hashing them.
  • Multiple, independant bundles: /src/[name]/main.js --> /dist/[name]/bundle.js

##Enhancements:

Copy static assets

I've created copy-loader and copy-url-loader. Meanwhile, they are improving the file-loader

--sync flag

Adds the webpack-dev-server live-reload to the bundle, so you have live-reload without the default iframe.

--cordova=index.html

  • update ./config.xml entry-point. When --sync is specified, points to webpack-dev-server.
  • update ./config.xml to package.json version (convenience stuff)
  • set output-path to ./www

--minify

  • similar to -p, but I can config the values. I turned UglifyJS mangle off, because it broke an app.

--target

  • shortcut to set a global window.TARGET variable. Useful to maintain multiple configurations.

--bundle=xxxx

  • only pack a single bundle (can improve build times if you have lot of bundles)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment