From 3537f999904a15dada4a2c2a6175b103949459eb 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 | 39 +++++++++++++++++++++++++++++++++++++++ webpack.config.js | 25 +++++++++++++++++++++++++ 3 files changed, 81 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..ce83f8b --- /dev/null +++ b/webpack-production.config.js @@ -0,0 +1,39 @@ +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: true + } + }) + ] +}; + diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..e2e9c12 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,25 @@ +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