diff --git a/.babelrc b/.babelrc
index 05581748b..01d096c1f 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,3 +1,10 @@
{
- "presets": ["es2015", "stage-2"]
+ "env": {
+ "development": {
+ "presets": ["es2015", "stage-2"]
+ },
+ "production": {
+ "presets": ["es2015-rollup"]
+ }
+ }
}
diff --git a/README.md b/README.md
index 5c79e60b8..d1f1b84c8 100644
--- a/README.md
+++ b/README.md
@@ -6,10 +6,8 @@
-## NOTE: Vuex is still in development - API may change anytime.
-
- [Documentation](http://vuex.vuejs.org/)
-- [Great introduction and explanation by @skyronic](http://skyronic.com/2016/01/03/vuex-basics-tutorial/)
+- [Great introduction and explanation by @skyronic](http://skyronic.com/2016/01/03/vuex-basics-tutorial/) (using outdated 0.3.0 API, but still worth a read!)
## Examples
diff --git a/bower.json b/bower.json
index 991d45a14..cc13a359c 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "vuex",
- "main": "lib/index.js",
+ "main": "dist/vuex.js",
"description": "state management for Vue.js",
"authors": "Evan You",
"license": "MIT",
diff --git a/build/build.js b/build/build.js
new file mode 100644
index 000000000..861395b37
--- /dev/null
+++ b/build/build.js
@@ -0,0 +1,70 @@
+process.env.BABEL_ENV = 'production'
+
+var fs = require('fs')
+var zlib = require('zlib')
+var rollup = require('rollup')
+var uglify = require('uglify-js')
+var babel = require('rollup-plugin-babel')
+var version = process.env.VERSION || require('../package.json').version
+
+var banner =
+ '/*!\n' +
+ ' * Vuex v' + version + '\n' +
+ ' * (c) ' + new Date().getFullYear() + ' Evan You\n' +
+ ' * Released under the MIT License.\n' +
+ ' */'
+
+rollup.rollup({
+ entry: 'src/index.js',
+ plugins: [babel()]
+})
+.then(function (bundle) {
+ return write('dist/vuex.js', bundle.generate({
+ format: 'umd',
+ banner: banner,
+ moduleName: 'Vuex'
+ }).code)
+})
+.then(function () {
+ // Standalone Production Build
+ return rollup.rollup({
+ entry: 'src/index.js',
+ plugins: [babel()]
+ })
+})
+.then(function (bundle) {
+ var code = bundle.generate({
+ format: 'umd',
+ moduleName: 'Vuex'
+ }).code
+ var minified = banner + '\n' + uglify.minify(code, {
+ fromString: true,
+ output: {
+ ascii_only: true
+ }
+ }).code
+ return write('dist/vuex.min.js', minified)
+})
+.catch(logError)
+
+function write (dest, code) {
+ return new Promise(function (resolve, reject) {
+ fs.writeFile(dest, code, function (err) {
+ if (err) return reject(err)
+ console.log(blue(dest) + ' ' + getSize(code))
+ resolve()
+ })
+ })
+}
+
+function getSize (code) {
+ return (code.length / 1024).toFixed(2) + 'kb'
+}
+
+function logError (e) {
+ console.log(e)
+}
+
+function blue (str) {
+ return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m'
+}
diff --git a/dist/vuex.js b/dist/vuex.js
new file mode 100644
index 000000000..41a2e8904
--- /dev/null
+++ b/dist/vuex.js
@@ -0,0 +1,506 @@
+/*!
+ * Vuex v0.4.1
+ * (c) 2016 Evan You
+ * Released under the MIT License.
+ */
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
+ (factory((global.Vuex = global.Vuex || {})));
+}(this, function (exports) { 'use strict';
+
+ var babelHelpers = {};
+ babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
+ return typeof obj;
+ } : function (obj) {
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
+ };
+
+ babelHelpers.classCallCheck = function (instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+ };
+
+ babelHelpers.createClass = function () {
+ function defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) descriptor.writable = true;
+ Object.defineProperty(target, descriptor.key, descriptor);
+ }
+ }
+
+ return function (Constructor, protoProps, staticProps) {
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
+ if (staticProps) defineProperties(Constructor, staticProps);
+ return Constructor;
+ };
+ }();
+
+ babelHelpers;
+
+ /**
+ * Merge an array of objects into one.
+ *
+ * @param {Array