From b8a3e431c7d519af20f7aac96f649570f8f386da Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 1 Oct 2017 22:02:14 +0900 Subject: [PATCH] add build step --- package.json | 4 +++- webpack.config.js | 12 +++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2a255c8..f2fe0ca 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,10 @@ "name": "vim-vixen", "description": "Vim vixen", "scripts": { - "start": "webpack -w --debug", + "start": "webpack -w -d", "lint": "eslint --ext .jsx,.js src", + "build": "NODE_ENV=production webpack --progress --display-error-details", + "lint": "eslint src", "test": "karma start" }, "repository": { diff --git a/webpack.config.js b/webpack.config.js index 977ea75..16d437f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,10 +1,11 @@ -var HtmlWebpackPlugin = require('html-webpack-plugin'); -var path = require('path'); +const MinifyPlugin = require("babel-minify-webpack-plugin"); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const path = require('path'); const src = path.resolve(__dirname, 'src'); const dist = path.resolve(__dirname, 'build'); -module.exports = { +config = { entry: { content: path.join(src, 'content'), settings: path.join(src, 'settings'), @@ -56,3 +57,8 @@ module.exports = { }) ] }; +if (process.env.NODE_ENV === 'production') { + config.plugins.push(new MinifyPlugin()); +} + +module.exports = config