代码拉取完成,页面将自动刷新
同步操作将从 苏州臻和信息科技有限公司/react-demo 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/* global process,__dirname:true*/
const path = require("path");
const webpack = require("webpack");
// const EX = require("extract-text-webpack-plugin"); //css 单独打包
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); //css 单独打包
// const EXCSS = new EX('[name].css');
const env=process.env.NODE_ENV;
console.log("env",env);
const port="8081";
const entry={
vendor:["react","react-dom","react-router","react-router-dom","react-redux",
"redux-thunk","redux","lodash","natty-fetch-fd","nprogress","leaflet"],
index:"./src/app/app.js"
};
const mode= env?'production':'development';
const plugins= [
new MiniCssExtractPlugin({
filename: mode === 'development' ? '[name].css' : '[name].[hash].css',
chunkFilename: mode === 'development' ? '[id].css' : '[id].[hash].css',
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.ProvidePlugin({
React:"react"
}),
new webpack.DefinePlugin({
'__ENV__':JSON.stringify(env)
})
];
module.exports ={
mode:mode,
entry:entry,
output: {
filename: "[name].js",
path: path.resolve(__dirname,"dist")
},
performance:{
hints:false
},
optimization:{
splitChunks:{
cacheGroups:{
vendor:{
name:'vendor',
chunks:'initial',
minChunks:2
}
}
}
},
devServer: {
disableHostCheck: true,
// historyApiFallback:true,
hot: true,
inline: true, // 实时刷新
host: '0.0.0.0',
port,
/*devServe跨域代理配置*/
proxy:{
'/proxy':{
target:"http://localhost:8083",
pathRewrite:{'^/proxy':''},
changeOrigin:true,
secure:false
}
}
},
resolve: {
alias: {
'@':path.resolve(__dirname,'src')
}
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
include: [
path.resolve(__dirname,'src')
],
loader: 'babel-loader'
},
{
test: /\.(png|jpg|gif)$/,
use: [
{
loader: "url-loader",
options: {
limit:8192
}
}
]
},
{
test: /\.(less|css)$/,
exclude: /node_modules/,
use: [
mode === 'development' ? 'style-loader' : MiniCssExtractPlugin.loader,
'css-loader',
'less-loader'
],
}
/* ,{
test: /\.(less|css)$/,
exclude: /node_modules/,
use: EXCSS.extract({
fallback:'style-loader',
use:['css-loader','less-loader']
})
}*/
,{
test: /\.css$/,
exclude: /src/,
use: [
{
loader: "style-loader"
},{
loader: 'css-loader',
options: {
importLoaders:1
}
}
]
},{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: "eslint-loader"
}
],
},
plugins
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。