From 61f93ed521b5016e87e9364ea54f920b19c408c7 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 6 Apr 2016 18:07:54 +0800 Subject: [PATCH] chore: update publish scripts --- package.json | 4 +++- webpack.config.js | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 42819ef99d..3e85a9817f 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,8 @@ }, "main": "lib/index", "files": [ + "dist", + "!dist/common.js", "lib", "style" ], @@ -125,7 +127,7 @@ "dora": "ANTD=WEBSITE dora -p 8001 --plugins webpack?disableNpmInstall,hmr", "start": "npm run clean-build && npm run dora", "copy-html": "cp ./index.html ./_site/index.html && mkdir ./_site/_site && mv ./_site/demo-* ./_site/_site", - "site": "npm run clean-build && ANTD=WEBSITE atool-build -o ./_site && npm run copy-html && ANTD=PRODUCTION atool-build && cp -R dist _site/dist", + "site": "npm run clean-build && ANTD=WEBSITE atool-build -o ./_site && npm run copy-html", "deploy": "rm -rf node_modules && node scripts/install.js && npm run just-deploy", "just-deploy": "npm run site && node scripts/deploy.js", "lint": "npm run srclint && npm run demolint && npm run lesshint", diff --git a/webpack.config.js b/webpack.config.js index 270fbd073e..310f0ef423 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,3 +1,5 @@ +const webpack = require('atool-build/lib/webpack'); + module.exports = function(webpackConfig) { if (process.env.ANTD === 'WEBSITE') { webpackConfig.entry = { @@ -11,8 +13,9 @@ module.exports = function(webpackConfig) { } if (process.env.ANTD === 'PRODUCTION') { + const entry = ['./style/index.less', './index.js']; webpackConfig.entry = { - 'antd': ['./style/index.less', './index.js'] + 'antd.min': entry, }; webpackConfig.externals = { 'react': { @@ -30,6 +33,19 @@ module.exports = function(webpackConfig) { }; webpackConfig.output.library = 'antd'; webpackConfig.output.libraryTarget = 'umd'; + + const uncompressedWebpackConfig = Object.assign({}, webpackConfig); + uncompressedWebpackConfig.entry = { + antd: entry, + }; + uncompressedWebpackConfig.plugins = webpackConfig.plugins.filter((plugin) => { + return !(plugin instanceof webpack.optimize.UglifyJsPlugin); + }); + + return [ + webpackConfig, + uncompressedWebpackConfig, + ]; } return webpackConfig;