mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-21 22:53:56 +08:00
优化构建配置,提升构建效率和文件体积优化 1. 禁用生产环境的 source map:为了减少生产环境构建的文件体积,提高构建速度,生产环境下不再生成 source map。 2. 配置开发服务器代理:在 `devServer` 中配置了代理,解决了跨域问题,确保本地开发时可以顺利访问后端 API。 3. 动态插入 CDN 链接:在生产环境下,通过 `chainWebpack` 动态修改 HTML 插件配置,插入 CDN 链接,避免打包常用库(如 `vue`, `axios`, `element-ui` 等),从而减少打包体积。 4. 代码分割优化:优化了 `splitChunks` 配置,减少了小模块的分割,提升了构建效率和缓存利用率。增加了 `minSize` 和 `maxSize` 配置,避免过多的小模块被拆分。 5. 启用多线程压缩:在生产环境中,配置了 `TerserPlugin` 以启用并行压缩,减少了 JS 文件的压缩时间。 6. 启用 Gzip 压缩:通过 `CompressionPlugin` 配置了 Gzip 压缩,只压缩大于 20KB 的文件,减少了构建后的文件体积。 7. 配置 `externals`:通过 `externals` 排除了 `vue`, `vue-router`, `vuex`, `element-ui`, `axios`, `opus-decoder` 等库的打包,避免重复打包并通过 CDN 加载这些库。 8. 配置文件系统缓存:启用了 Webpack 文件系统缓存,加速了增量构建,缓存目录设置为 `.webpack_cache`,缓存有效期为一个月。 9. 配置 Webpack 别名:为项目中的路径配置了别名,简化了模块导入,减少了代码中的路径冗余。 10. 提供可选的打包分析:通过 `BundleAnalyzerPlugin` 插件,在 `ANALYZE=true` 环境变量下启用打包分析功能,帮助分析并优化构建后的文件。
160 lines
2.4 KiB
Plaintext
160 lines
2.4 KiB
Plaintext
# Byte-compiled / optimized / DLL files
|
|
__pycache__/
|
|
.idea/
|
|
*.py[cod]
|
|
*$py.class
|
|
|
|
# C extensions
|
|
*.so
|
|
|
|
# Distribution / packaging
|
|
.Python
|
|
build/
|
|
develop-eggs/
|
|
dist/
|
|
downloads/
|
|
eggs/
|
|
.eggs/
|
|
lib/
|
|
lib64/
|
|
parts/
|
|
sdist/
|
|
var/
|
|
wheels/
|
|
share/python-wheels/
|
|
*.egg-info/
|
|
.installed.cfg
|
|
*.egg
|
|
MANIFEST
|
|
|
|
# PyInstaller
|
|
# Usually these files are written by a python script from a template
|
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
*.manifest
|
|
*.spec
|
|
|
|
# Installer logs
|
|
pip-log.txt
|
|
pip-delete-this-directory.txt
|
|
|
|
# Unit testdata / coverage reports
|
|
htmlcov/
|
|
.tox/
|
|
.nox/
|
|
.coverage
|
|
.coverage.*
|
|
.cache
|
|
nosetests.xml
|
|
coverage.xml
|
|
*.cover
|
|
*.py,cover
|
|
.hypothesis/
|
|
.pytest_cache/
|
|
cover/
|
|
|
|
# Translations
|
|
*.mo
|
|
*.pot
|
|
|
|
# Django stuff:
|
|
*.log
|
|
local_settings.py
|
|
db.sqlite3
|
|
db.sqlite3-journal
|
|
|
|
# Flask stuff:
|
|
instance/
|
|
.webassets-cache
|
|
|
|
# Scrapy stuff:
|
|
.scrapy
|
|
|
|
# Sphinx documentation
|
|
docs/_build/
|
|
|
|
# PyBuilder
|
|
.pybuilder/
|
|
target/
|
|
|
|
# Jupyter Notebook
|
|
.ipynb_checkpoints
|
|
|
|
# IPython
|
|
profile_default/
|
|
ipython_config.py
|
|
|
|
# pyenv
|
|
# For a library or package, you might want to ignore these files since the code is
|
|
# intended to run in multiple environments; otherwise, check them in:
|
|
# .python-version
|
|
|
|
# pipenv
|
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
# install all needed dependencies.
|
|
#Pipfile.lock
|
|
|
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
__pypackages__/
|
|
|
|
# Celery stuff
|
|
celerybeat-schedule
|
|
celerybeat.pid
|
|
|
|
# SageMath parsed files
|
|
*.sage.py
|
|
|
|
# Environments
|
|
.venv
|
|
env/
|
|
venv/
|
|
ENV/
|
|
env.bak/
|
|
venv.bak/
|
|
|
|
# Spyder project settings
|
|
.spyderproject
|
|
.spyproject
|
|
|
|
# Rope project settings
|
|
.ropeproject
|
|
|
|
# mkdocs documentation
|
|
/site
|
|
|
|
# mypy
|
|
.mypy_cache/
|
|
.dmypy.json
|
|
dmypy.json
|
|
|
|
# Pyre type checker
|
|
.pyre/
|
|
|
|
# music directory
|
|
music/
|
|
|
|
# pytype static type analyzer
|
|
.pytype/
|
|
|
|
# Cython debug symbols
|
|
cython_debug/
|
|
*.iml
|
|
tmp
|
|
.history
|
|
.DS_Store
|
|
main/xiaozhi-server/data
|
|
main/xiaozhi-server/config/assets/wakeup_words.*
|
|
main/manager-web/node_modules
|
|
.config.yaml
|
|
.secrets.yaml
|
|
.private_config.yaml
|
|
|
|
# model files
|
|
main/xiaozhi-server/models/SenseVoiceSmall/model.pt
|
|
main/xiaozhi-server/models/sherpa-onnx*
|
|
my_wakeup_words.mp3
|
|
main/manager-api/.vscode
|
|
|
|
# Ignore webpack cache directory
|
|
main/manager-web/.webpack_cache/ |