7 Star 10 Fork 4

guanzhenxing / react-webpack-scaffold

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.deploy.config.js 1.97 KB
一键复制 编辑 原始数据 按行查看 历史
guanzhenxing 提交于 2016-01-22 21:10 . 基本的框架
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'eval',
entry: {
app: [
'./src/index'
],
vendors: ['crypto-js', 'history', 'humps', 'jquery', 'lodash', 'normalizr', 'object-assign', 'q', 'react', 'react-dom', 'underscore']
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].[chunkhash].js'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendors', '[name].[hash].js'),
new ExtractTextPlugin('app.[contenthash].css', {
allChunks: true
}),
new HtmlWebpackPlugin({
title: 'DEMO',
template: 'index-template.html',
inject: 'body'
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
}),
new webpack.DefinePlugin({
'process.env': {NODE_ENV: JSON.stringify('production')}
})
],
resolve: {
modulesDirectories: [
'node_modules'
]
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['react-hot', 'babel?optional[]=runtime'],
include: path.join(__dirname, 'src')
}, {
test: /\.css$/,
exclude: [
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'src/static/style')
],
loader: ExtractTextPlugin.extract('style', 'css?modules!autoprefixer?{browsers:["> 5%", "ie 9"]}')
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css?autoprefixer?{browsers:["> 5%", "ie 9"]}')
}, {
test: /\.(svg|png|jpg|jpeg|gif)$/i,
loaders: ['file']
}]
}
};
NodeJS
1
https://gitee.com/guanzhenxing/react-webpack-scaffold.git
git@gitee.com:guanzhenxing/react-webpack-scaffold.git
guanzhenxing
react-webpack-scaffold
react-webpack-scaffold
master

搜索帮助