代码拉取完成,页面将自动刷新
同步操作将从 muiplayer/hello-muiplayer 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
'use strict';
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
devtool: process.env.NODE_ENV == 'production' ? 'none' : 'inline-source-map',
entry: ['./src/main.js'],
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[chunkhash].js',
chunkFilename: '[id].[chunkhash].js', // 非入口的chunk文件的名称
},
devServer:{
port:8089,
host:'0.0.0.0',
// host:'localhost',
open:false,
compress:true,
quiet: true,
},
module: {
rules: [
{
test:/\.(css|less)$/,
use:[MiniCssExtractPlugin.loader,'css-loader','postcss-loader','less-loader']
},
{
test:/\.js$/,
exclude:/node_modules/,
include: [
path.resolve(__dirname, "src"),
],
loader: "babel-loader",
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use:[
{
loader: 'url-loader',
options: {
limit: 200,
name:'[name].[hash:7].[ext]',
}
}
]
},
]
},
resolve: {
extensions: ['.js'],
alias:{
'@':path.resolve(__dirname,'src'),
'static': path.resolve(__dirname, '../static'),
}
},
optimization: {
minimize: true,
minimizer:process.env.NODE_ENV == 'production' ? [
// JS 文件压缩
new TerserPlugin({
cache: true,
terserOptions:{
compress: {
drop_console:true,
drop_debugger:true,
},
}
}),
// CSS 文件压缩
new OptimizeCssAssetsPlugin({}),
] : [],
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './index.html',
favicon:'./favicon.ico',
minify:false,
}),
// 分离CSS文件
new MiniCssExtractPlugin({
filename: '[name].[chunkhash].css',
chunkFilename: '[id].[chunkhash].css'
}),
new CleanWebpackPlugin(),
// copy custom static assets
new CopyWebpackPlugin([{
from: path.resolve(__dirname, 'static'),
to: './static',
ignore: ['.*']
}]),
]
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。