diff --git a/package.json b/package.json index 71b592a..2f945a9 100644 --- a/package.json +++ b/package.json @@ -29,14 +29,17 @@ "node-red": "^0.13.3", "node-red-contrib-pubnub": "0.0.3", "sass-brunch": "^1.9.2", - "uglify-js-brunch": "^1.7.8" + "uglify-js-brunch": "^1.7.8", + "webpack": "^1.12.14", + "webpack-dev-server": "^1.14.1" }, "scripts": { "test": "mocha -r mock-local-storage -r test/global --recursive --compilers js:babel-register", "start": "http-server -a 0.0.0.0 -p 9000", "simu": "node-red -u ./simu/ -s ./simu/settings.js -v", "docs": "docco app/js/**/*.*", - "lint": "./node_modules/eslint/bin/eslint.js --cache --fix ./app" + "lint": "./node_modules/eslint/bin/eslint.js --cache --fix ./app", + "watch": "webpack --watch" }, "repository": { "type": "git", diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..e78b1b9 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,31 @@ +var path = require('path'); +var webpack = require('webpack'); + +module.exports = { + entry: './app/js/lora.js', + output: { + path: __dirname, + filename: 'bundle.js' + }, + module: { + loaders: [ + { + loader: 'babel-loader', + test: path.join(__dirname, 'app/js'), + query: { + presets: 'es2015', + }, + } + ] + }, + plugins: [ + // Avoid publishing files when compilation fails + new webpack.NoErrorsPlugin() + ], + stats: { + // Nice colored output + colors: true + }, + // Create Sourcemaps for the bundle + devtool: 'source-map', +};