From 55438c57f7c339744594011c138073c13bdb8811 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 13 Sep 2016 16:05:35 +0000 Subject: [PATCH] Bug 17297 - Add npm and webpack config files --- package.json | 17 ++++++++++++++ webpack-production.config.js | 56 ++++++++++++++++++++++++++++++++++++++++++++ webpack.config.js | 24 +++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 package.json create mode 100644 webpack-production.config.js create mode 100644 webpack.config.js diff --git a/package.json b/package.json new file mode 100644 index 0000000..85321c9 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "Koha", + "description": "Koha Integrated Library System", + "devDependencies": { + "babel-core": "^6.14.0", + "babel-loader": "^6.2.5", + "babel-preset-react": "^6.11.1", + "react": "^15.3.1", + "react-dom": "^15.3.1", + "webpack": "^1.13.2" + }, + "repository": { + "type": "git", + "url": "git://git.koha-community.org/koha.git" + }, + "license": "GPLv3" +} diff --git a/webpack-production.config.js b/webpack-production.config.js new file mode 100644 index 0000000..ee64ba9 --- /dev/null +++ b/webpack-production.config.js @@ -0,0 +1,56 @@ +var webpack = require('webpack'); + +module.exports = { + entry: { + moredetail: './koha-tmpl/intranet-tmpl/prog/js/public/moredetail.js', + }, + output: { + path: './koha-tmpl/intranet-tmpl/prog/js/app', + filename: '[name].js' // Template based on keys in entry above + }, + module: { + loaders: [ + { + test: /\.js$/, + loader: 'babel-loader', + query: { + presets: ['react'] + } + } + ] + }, + resolve: { + // you can now require('file') instead of require('file.js') + extensions: ['', '.js', '.json'] + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env':{ + 'NODE_ENV': JSON.stringify('production') + } + }), + new webpack.optimize.UglifyJsPlugin({ + compress:{ + warnings: false + } + }) + ], + devServer: { + stats: { + colors: true, + hash: false, + version: false, + timings: false, + assets: false, + chunks: false, + modules: false, + reasons: false, + children: false, + source: false, + errors: false, + errorDetails: false, + warnings: false, + publicPath: false + } + } +}; diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..02d32cc --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,24 @@ +module.exports = { + entry: { + moredetail: './koha-tmpl/intranet-tmpl/prog/js/public/moredetail.js', + }, + output: { + path: './koha-tmpl/intranet-tmpl/prog/js/app', + filename: '[name].js' // Template based on keys in entry above + }, + module: { + loaders: [ + { + test: /\.js$/, + loader: 'babel-loader', + query: { + presets: ['react'] + } + } + ] + }, + resolve: { + // you can now require('file') instead of require('file.js') + extensions: ['', '.js', '.json'] + } +}; -- 2.1.4