代码拉取完成,页面将自动刷新
同步操作将从 zegodev/zego-express-webrtc-sample 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require('path');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const filterFileList = require('./tools');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const HtmlWebpackPlugin = require('html-webpack-plugin');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const webpack = require('webpack');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const miniCssExtractPlugin = require('mini-css-extract-plugin');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const internalIp = require('internal-ip');
const targetList = [];
const entry = {};
const htmlPlugins = [];
filterFileList('./src', targetList);
entry['content'] = targetList.find(item => item.endsWith('content.ts'));
targetList
.filter(item => item.endsWith('index.ts'))
.forEach(p => {
const regResult = /.+src[\/|\\](.+)[\/|\\]index.ts$/.exec(p);
if (regResult && regResult[1]) {
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,
mode: 'development',
output: {
filename: '[name]/[name].bundle.js',
path: path.resolve(__dirname, 'docs'),
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
module: {
rules: [
{
test: /\.css$/,
use: [
miniCssExtractPlugin.loader,
{
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: [
...htmlPlugins,
new miniCssExtractPlugin({
filename: 'index.[contenthash:8].css',
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.$': 'jquery',
'window.jQuery': 'jquery',
}),
],
devServer: {
contentBase: './docs',
port: 9090,
host: internalIp.v4.sync(),
https: true,
},
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。