reactjs - 在 React 和 webpack 中包含 manifest.js NOT manifest.json
问题描述
我能找到的所有解决方案都在谈论manifest.json
。我可能会遇到这个错误,但是在我的 manifest.js 中,我的`manifest.js 中有一些要求,所以我认为它不可能是一个 json 文件。
我尝试在我webpack.config.js
的 .
{
test: /manifest.js$/,
use: [
{
loader: "file-loader",
options: {
name: "ui/[name].[hash].json",
},
},
"extract-loader",
],
},
这是我的manifest.js
const Icon192 = require("../images/icon-192x192.png");
const Icon512 = require("../images/icon-512x512.png")
const manifest = {
icons: [
{
src: Icon192,
sizes: "192x192",
type: "image/png",
},
{
src: Icon512,
sizes: "512x512",
type: "image/png",
},
],
name: "My_App",
short_name: "My_App",
orientation: "portrait",
display: "standalone",
start_url: "/",
theme_color: " #228B22",
background_color: "#ffffff",
description: "Any Maskable",
start_url: "https://example.com",
display: "browser",
prefer_related_applications: false
};
module.exports = JSON.stringify(manifest, null, 2);
如果我不需要这些要求,并且可以以不同的方式做到这一点,请告诉我
解决方案
推荐阅读
- matlab - 如何确保我的优化算法找到了解决方案?
- reactjs - 使用 Gatsby.js 在重定向中捕获参数
- python - pyinstaller 不能包含包
- c# - Kendo ASP.NET MVC Grid Pageable() 属性组合
- python - Django 和 Yubikey 集成
- python-3.x - 如何创建从 a 到 z 和 A 到 Z 的列表
- qt - 如何在 qml 中创建自定义本地模板对象?
- python-3.x - 使用 MergeTree 引擎 Clickhouse 创建分区键时出错
- python - 一个语句执行后数据库文件关闭,类型错误:“NoneType”对象不可下标
- android - Android 应用错误 - 您必须在 Google Cloud 项目上启用结算功能