1 Star 0 Fork 0

zhangjing9898 / commentApp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 2.21 KB
一键复制 编辑 原始数据 按行查看 历史
zhangjing9898 提交于 2018-06-06 21:00 . loginpage
/**
* Created by litong on 2017/6/6.
*/
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const op = require('open-browser-webpack-plugin')
const webpack = require('webpack')
module.exports = {
entry: path.resolve(__dirname,'app/index'),
output: {
path: __dirname + '/build',
filename: "bundle.js"
},
resolve: {
extensions: ['.js','jsx']
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
include: /app/,
loader: "babel-loader",
query: {
cacheDirectory: true,
plugins: [["import", { libraryName: "antd", style: "css" }]]
}
},
{
test: /\.css$/,
use : [
{
loader : 'style-loader'
},
{
loader: 'css-loader',
options: {
importLoaders: 1
}
},
{
loader: 'postcss-loader',
options : {
plugins : function() {
return [
require('autoprefixer')({
broswers : ['last 5 versions']
})
];
}
}
}
]
},
{
test: /\.less$/,
loader: 'style-loader!css-loader!less-loader'
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader'
},
{
test: /\.(png|jpg|svg|gif|jpeg|bmp)$/,
loader: 'url-loader',
options: {
limit: 5000
}
}
]
},
plugins: [
new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse((process.env.NODE_ENV == 'dev') || 'false'))
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.LoaderOptionsPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: __dirname + '/app/index.html'
}),
new op({
url: 'http://127.0.0.1:8000'
})
],
devServer: {
//此处是webpack-dev-server的配置
proxy: {
'/api': {
target: 'http://127.0.0.1:3000',
secure:false
}
},
contentBase: './public',
historyApiFallback: true,
inline: true,
hot: true
}
}
JavaScript
1
https://gitee.com/zj9898/commentApp.git
git@gitee.com:zj9898/commentApp.git
zj9898
commentApp
commentApp
master

搜索帮助