diff --git a/package.json b/package.json index 9bd41a8..296f5ca 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "start": "npm run dll && npm run dev", "dev": "NODE_ENV=development webpack-dev-server", "dll": "webpack --config webpack.dll.js -p", - "build": "webpack -p" + "build": "webpack --config webpack.build.js -p" }, "author": "", "license": "ISC", diff --git a/webpack.build.js b/webpack.build.js new file mode 100644 index 0000000..9c47074 --- /dev/null +++ b/webpack.build.js @@ -0,0 +1,45 @@ +const path = require('path'); +const webpack = require('webpack'); +const autoprefixer = require('autoprefixer'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); + +const config = { + context: __dirname, + entry: { + dragresize: './src/Dragresize.jsx', + }, + output: { + path: path.resolve(__dirname, './dist'), + filename: '[name].js', + }, + resolve: { + root: [ + path.join(__dirname, '/src'), + ], + extensions: ['', '.js', '.jsx'], + }, + module: { + noParse: [], + loaders: [ + { test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/ }, + { + test: /\.less|\.css$/, + loader: ExtractTextPlugin.extract('style-loader', 'css?minimize&modules&localIdentName=[local]__[hash:base64:10]!postcss!less'), + }, + ], + }, + postcss: () => { + return [autoprefixer]; + }, + plugins: [ + new ExtractTextPlugin('[name].css'), + new webpack.optimize.UglifyJsPlugin({ + compress: { + warnings: false, + }, + }), + ], +}; + + +module.exports = config;