Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
minifiy
Browse files Browse the repository at this point in the history
  • Loading branch information
nghiepdev committed Dec 28, 2017
1 parent 6b74fa8 commit 7d72a45
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

lib
index.min.js
bundle.js
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "react-redux-modal-flex",
"version": "1.0.3",
"version": "1.0.4",
"description": "Make easy a modal/popup with Redux",
"author": "Nghiệp<[email protected]>",
"homepage": "http://react-redux-modal-flex.surge.sh",
"main": "lib/index.js",
"main": "index.min.js",
"files": ["lib"],
"dependencies": {
"classnames": "^2.2.5",
Expand Down Expand Up @@ -40,7 +40,8 @@
},
"scripts": {
"dev": "./node_modules/.bin/webpack-dev-server",
"lib": "./node_modules/.bin/babel src --out-dir lib",
"lib":
"cross-env NODE_ENV=production ./node_modules/.bin/webpack --config webpack.lib.config.js --progress --profile -p",
"build":
"cross-env NODE_ENV=production ./node_modules/.bin/webpack --progress --profile -p",
"demo":
Expand Down
67 changes: 67 additions & 0 deletions webpack.lib.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
'use strict';

const webpack = require('webpack');
const path = require('path');

module.exports = {
entry: {
'index.min': './src/index.js',
},

externals: ['react', 'react-dom', 'prop-types', 'redux', 'react-redux'],

output: {
filename: '[name].js',
chunkFilename: '[id].chunk.js',
publicPath: '/',
libraryTarget: 'umd',
library: 'ReactReduxModalFlex',
},

resolve: {
extensions: ['.js', '.jsx'],
},

plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true,
compress: {
warnings: false,
comparisons: false,
},
output: {
comments: false,
ascii_only: true,
},
}),
new webpack.optimize.ModuleConcatenationPlugin(),
],

module: {
strictExportPresence: true,
rules: [
{
test: /\.(js|jsx)$/,
loader: require.resolve('babel-loader'),
options: {
compact: true,
},
},
{
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
],
},
],
},
};

0 comments on commit 7d72a45

Please sign in to comment.