|
@@ -0,0 +1,92 @@
|
|
|
+const webpack = require('webpack');
|
|
|
+const path = require('path');
|
|
|
+const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
|
|
+const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
+
|
|
|
+let theme = {
|
|
|
+ '@primary-color': '#1DA57A',
|
|
|
+ '@link-color': '#1DA57A',
|
|
|
+ '@border-radius-base': '8px'
|
|
|
+};
|
|
|
+
|
|
|
+module.exports = {
|
|
|
+ entry: {
|
|
|
+ 'user/index': './js/user/index.js',
|
|
|
+ 'user/login': './js/user/login.js',
|
|
|
+ 'admin/index':'./js/admin/index.js',
|
|
|
+ vendors: ['jquery']
|
|
|
+ },
|
|
|
+ output: {
|
|
|
+ path: path.resolve(__dirname, './build'),
|
|
|
+ filename: '[name].js',
|
|
|
+ },
|
|
|
+ module: {
|
|
|
+ loaders: [{
|
|
|
+ test: /\.jsx?$/,
|
|
|
+ exclude: /node_modules/,
|
|
|
+ loader: 'babel-loader',
|
|
|
+ query: {
|
|
|
+ "presets": ["es2015", "react"],
|
|
|
+ "plugins": [
|
|
|
+ ["antd", {
|
|
|
+ "style": true
|
|
|
+ }]
|
|
|
+ ]
|
|
|
+ }
|
|
|
+
|
|
|
+ }, {
|
|
|
+ test: /\.css$/,
|
|
|
+ loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
|
|
|
+ }, {
|
|
|
+ test: /\.less$/,
|
|
|
+ loader: ExtractTextPlugin.extract('style', `css!less?{"modifyVars":${JSON.stringify(theme)}}`)
|
|
|
+ }, {
|
|
|
+ test: /\.(png|jpg)$/,
|
|
|
+ loader: 'url?limit=8192&name=[path][name].[ext]'
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ resolve: {
|
|
|
+ extensions: ['', '.js', '.jsx']
|
|
|
+ },
|
|
|
+ plugins: [
|
|
|
+
|
|
|
+ new webpack.optimize.UglifyJsPlugin({
|
|
|
+ minimize: true,
|
|
|
+ compress: {
|
|
|
+ warnings: true
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ new webpack.DefinePlugin({
|
|
|
+ "process.env": {
|
|
|
+ NODE_ENV: JSON.stringify("production")
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ new ExtractTextPlugin('[name].css', {
|
|
|
+ allChunks: true
|
|
|
+ }),
|
|
|
+
|
|
|
+ new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
|
|
|
+
|
|
|
+
|
|
|
+ new HtmlWebpackPlugin({
|
|
|
+ title: 'user_index',
|
|
|
+ filename: 'user/index.html',
|
|
|
+ template: './template/template.html',
|
|
|
+ chunks:['user/index','vendors']
|
|
|
+ }),
|
|
|
+ new HtmlWebpackPlugin({
|
|
|
+ title: 'user_login',
|
|
|
+ filename: 'user/login.html',
|
|
|
+ template: './template/template.html',
|
|
|
+ chunks:['user/login','vendors']
|
|
|
+ }),
|
|
|
+
|
|
|
+
|
|
|
+ new HtmlWebpackPlugin({
|
|
|
+ title: 'admin_index',
|
|
|
+ filename: 'admin/index.html',
|
|
|
+ template: './template/template.html',
|
|
|
+ chunks:['admin/index','vendors']
|
|
|
+ })
|
|
|
+ ]
|
|
|
+};
|