代码拉取完成,页面将自动刷新
同步操作将从 zegodev/zego-express-webrtc-sample 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const path = require('path');
const filterFileList = require('./tools');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerWebpackPlugin = require("css-minimizer-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const internalIp = require('internal-ip');
const tempList = [];
const entry = {};
const htmlPlugins = [];
filterFileList('./src', tempList);
const targetList = tempList.filter(path => {
if (path.includes('docsSharing') || path.includes('whiteboard')) {
return false;
} else {
return true;
}
});
entry['content'] = targetList.find(item => item.endsWith('content.js'));
targetList
.filter(item => item.endsWith('index.js'))
.forEach(p => {
const regResult = /.+src[\/|\\](.+)[\/|\\]index\.js$/.exec(p);
if (regResult && regResult[1]) {
regResult[0] = regResult[0].replace(/\/index\.js$/, "")
entry[regResult[1]] = regResult[0];
}
});
targetList
.filter(item => item.endsWith('index.html'))
.forEach(tepmlate => {
const regResult = /.+src[\/|\\](.+)[\/|\\]index.html$/.exec(tepmlate);
if (regResult && regResult[1]) {
htmlPlugins.push(
new HtmlWebpackPlugin({
template: tepmlate,
chunks: [regResult[1]],
filename: regResult[1] + '/index.html'
})
);
} else if (tepmlate.includes('src/index.html')) {
htmlPlugins.push(
new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html',
chunks: ['content'],
favicon: './src/favicon.ico'
})
);
}
});
module.exports = {
entry,
// entry: {
// rangeAudio: "/Users/zego/Documents/WorkspaceWeb/alpha-express-webrtc-sample/src/rangeAudio"
// },
mode: 'development',
output: {
filename: '[name]/[name].bundle.js',
path: path.resolve(__dirname, 'docs'),
libraryTarget: "umd",
umdNamedDefine: true,
globalObject: "typeof self !== 'undefined' ? self : this"
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.css$/,
use: [
// MiniCssExtractPlugin.loader,
{ loader: "style-loader" }, // 如果想要在运行时动态插入 style 标签,就使用这个加载器
{
loader: 'css-loader'
// options: {
// url: false,
// },
}
]
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
use: [
{
loader: 'url-loader',
options: {
limit: 8192,
name: '[name].[ext]',
fallback: 'file-loader', //超过了限制大小调用回调函数
outputPath: 'public/images' //片存储的地址
}
}
]
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000, // 小于10000 / 1024 kb的字体会被url-loader压缩成base64格式
name: 'static/font/[name].[hash:7].[ext]' //字体名字,7位哈希值,扩展名
}
}
]
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: require.resolve('jquery'),
loader: 'expose-loader?$!expose-loader?jQuery'
}
]
},
plugins: [
new CleanWebpackPlugin(),
...htmlPlugins,
// new MiniCssExtractPlugin({
// filename: path.resolve(__dirname, "[name].css"), // 指定生成的 CSS 文件名
// }),
new CopyWebpackPlugin({
patterns: [
{
from:
"./node_modules/zego-express-engine-webrtc/background-process/assets"
,
to: "./assets"
},
{
from:
"./src/assets/zego-express-player"
,
to: "./assets/zego-express-player"
}
// { from: './src/docsSharing', to: './docsSharing' },
// { from: './src/whiteboard', to: './whiteboard' },
]
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.$': 'jquery',
'window.jQuery': 'jquery'
})
// new HtmlWebpackPlugin({
// template: "/Users/zego/Documents/WorkspaceWeb/alpha-express-webrtc-sample/src/rangeAudio/index.html",
// chunks: ["rangeAudio"],
// filename: 'rangeAudio/index.html',
// }),
],
// devtool: 'eval-source-map',
optimization: {
minimizer: [
// new CssMinimizerWebpackPlugin() // 压缩生成的 CSS 文件
]
},
devServer: {
disableHostCheck: true,
contentBase: './docs',
port: 9092,
host: internalIp.v4.sync(),
https: true,
open: true
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。