Skip to content

Commit

Permalink
add webpack build config
Browse files Browse the repository at this point in the history
  • Loading branch information
cedcn committed Aug 29, 2016
1 parent 48210f5 commit b2d0d37
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
45 changes: 45 additions & 0 deletions webpack.build.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit b2d0d37

Please sign in to comment.