feat: webpack优化

This commit is contained in:
hackrobot
2025-04-02 04:34:52 -05:00
parent 281780b54f
commit 87fffa4f37
2 changed files with 111 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
import path from 'path'
const { GenerateSW } = require("workbox-webpack-plugin");
import path from "path";
// const { GenerateSW } = require("workbox-webpack-plugin");
const config = {
projectName: "cityh5",
@@ -27,42 +27,53 @@ const config = {
h5: {
webpackChain(chain) {
if (
process.env.NODE_ENV === "production" &&
!chain.plugins.has("workbox")
) {
chain.plugin("workbox").use(GenerateSW, [
chain.output.filename("static/js/[name].[contenthash:8].js");
chain.output.chunkFilename("static/js/[name].[contenthash:8].js");
chain
.plugin("MiniCssExtractPlugin")
.use(require("mini-css-extract-plugin"), [
{
clientsClaim: true,
skipWaiting: true,
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10MB
runtimeCaching: [
{
urlPattern: /.*\.(?:png|jpg|jpeg|svg|gif|ico)/,
handler: "CacheFirst",
options: {
cacheName: "images-cache",
expiration: {
maxEntries: 50,
maxAgeSeconds: 30 * 24 * 60 * 60,
},
},
},
{
urlPattern: /.*\.(?:js|css)/,
handler: "StaleWhileRevalidate",
options: {
cacheName: "static-resources",
expiration: {
maxEntries: 50,
maxAgeSeconds: 7 * 24 * 60 * 60,
},
},
},
],
filename: "static/css/[name].[contenthash:8].css",
chunkFilename: "static/css/[name].[contenthash:8].css",
},
]);
}
// if (
// process.env.NODE_ENV === "production" &&
// !chain.plugins.has("workbox")
// ) {
// chain.plugin("workbox").use(GenerateSW, [
// {
// clientsClaim: true,
// skipWaiting: true,
// maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10MB
// runtimeCaching: [
// {
// urlPattern: /.*\.(?:png|jpg|jpeg|svg|gif|ico)/,
// handler: "CacheFirst",
// options: {
// cacheName: "images-cache",
// expiration: {
// maxEntries: 50,
// maxAgeSeconds: 30 * 24 * 60 * 60,
// },
// },
// },
// {
// urlPattern: /.*\.(?:js|css)/,
// handler: "StaleWhileRevalidate",
// options: {
// cacheName: "static-resources",
// expiration: {
// maxEntries: 50,
// maxAgeSeconds: 7 * 24 * 60 * 60,
// },
// },
// },
// ],
// },
// ]);
// }
chain.module
.rule("markdown")
.test(/\.md$/)
@@ -80,7 +91,9 @@ const config = {
},
esnextModules: ["taro-ui"],
publicPath: "/",
// publicPath: "/",
publicPath: `/v${new Date().getTime()}/`,
staticDirectory: "static",
postcss: {
autoprefixer: {
@@ -125,13 +138,15 @@ const config = {
},
},
// 允许特定域名访问
allowedHosts: [
// 'bot.hackrobot.cn'
"nomadyt.com",
],
allowedHosts: ["nomadyt.com", "localhost", ".nomadyt.com"], // 允许所有 *.nomadyt.com 子域访问
},
htmlPluginOption: {
favicon: path.resolve(__dirname, "..", "src", "images", "youtube.ico"), // 同样处理 favicon 路径
meta: {
"cache-control": "no-cache, no-store, must-revalidate",
pragma: "no-cache",
expires: "0",
},
},
target: ["web", "browserslist:> 0.25%, not dead"],

View File

@@ -268,6 +268,62 @@ youtube官方,算法会检测到刷量行为,不仅会有清空,还有封号的
---
# 硬件设备与剪辑软件
## 4k高清
> 使用`剪映`进行剪辑
在商业软件中,剪映,已对普通创者者做了优化
不用像专业的剪辑师一样,了解adobe的各种理念和操作
<img title="" src="https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/2025-04-02-04-22-07-%E5%89%AA%E6%98%A0%E5%AE%98%E7%BD%91-%E5%85%A8%E8%83%BD%E6%98%93%E7%94%A8%E7%9A%84%E6%A1%8C%E9%9D%A2%E7%AB%AF%E5%89%AA%E8%BE%91%E8%BD%AF%E4%BB%B6-%E8%BD%BB%E8%80%8C%E6%98%93%E5%89%AA%20%E4%B8%8A%E6%BC%94%E5%A4%A7%E5%B9%95.png?imageSlim" alt="2025-04-02-04-22-07-剪映官网-全能易用的桌面端剪辑软件-轻而易剪 上演大幕.png" width="389">
运营youtube的细节是
- 输出成4K高清,AI 补帧
- 生成srt字幕 (支持双语)
当然,开源免费的剪辑软件也有[shotcut](https://github.com/mltframework/shotcut)
<img src="https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/2025-04-02-04-26-38-mltframework_shotcut_%20cross-platform%20(Qt)%2C%20open-source%20(GPLv3)%20video%20editor.png?imageSlim" title="" alt="2025-04-02-04-26-38-mltframework_shotcut_ cross-platform (Qt), open-source (GPLv3) video editor.png" width="406">
---
## 游戏笔记本
> 使用`显卡`渲染
<img src="https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/wddwfwegewg.jpg?imageSlim" title="" alt="wddwfwegewg.jpg" width="400">
建议入手一个`游戏笔记本`,其最低可以包含
- 8GB显卡
- 1TB固态硬盘
- 2k高清显示屏
这对剪辑视频来说,可以大大节省时间,也避免了硬盘空间的不足的情况
当然,从性价比来说,品牌肯定不是适合电竞的`外星人`,而是`机械革命`之类
> 配件:`视频采集卡`
如果不是拍摄,而是录制屏幕,制作教程类
可以准备1个视频采集卡,最好有hdml`环出`功能
这样可以在硬件间进行录制,而不影响主屏幕
---
# 开通Adsense:接收PIN码实体信
# 收款:银行卡与结汇
# 24小时无人直播