我有一个使用 React 开发的网站,它有一个页面,但生产包大小为 1.11 MiB。我正在使用 firestore、firebase storage、material-UI、react-redux 这个应用程序,应用程序运行良好,除了包大小之外,一切都很好。
我使用 webpack-bundle-analyzer 来分析包大小,看起来 nodemodules 占用了很大的大小。在这里我添加了屏幕截图。

我的 webpack 配置文件
const path = require('path');
var CompressionPlugin = require('compression-webpack-plugin');
const TerserPlugin = require("terser-webpack-plugin");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
mode: 'production',
entry: './src/public/index.js',
plugins: [
new BundleAnalyzerPlugin({
generateStatsFile : true
}),
new CompressionPlugin({
deleteOriginalAssets: false,
filename: "[path][base].gz",
algorithm: "gzip",
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
// Compress all assets, including files with `0` bytes size
// minRatio: Infinity
// Compress all assets, excluding files with `0` …Run Code Online (Sandbox Code Playgroud) 我正在尝试将 Loadable 组件集成到我的 SSR 项目中,当我在 localhost:3000 中执行时它正在工作,然后我尝试将它部署在云功能中我收到此错误
[ERR_INVALID_ARG_TYPE]:“路径”参数必须是字符串类型。收到未定义
之后我尝试部署可加载组件服务器端渲染示例,示例代码也给出了同样的错误。
我在 package.json、server main.js 和 app.js 文件中做了一些更改以在 Cloud 函数中工作
这是我的服务器 main.js 文件
import path from 'path'
import express from 'express'
import React from 'react'
import { renderToString } from 'react-dom/server'
import { ChunkExtractor } from '@loadable/server'
import App from '../client/App'
const functions = require('firebase-functions');
const app = express()
//app.use(express.static(path.join(__dirname, '../../public')))
const nodeStats = path.resolve(
__dirname,
'../../public/dist/async-node/loadable-stats.json',
)
const webStats = path.resolve(
__dirname,
'../../public/dist/web/loadable-stats.json',
)
app.get('*', (req, res) => {
const …Run Code Online (Sandbox Code Playgroud) javascript node.js reactjs google-cloud-functions loadable-component
我已经创建了一个 svelte 应用程序并使用 SvelteKit 构建应用程序,一切正常。
我尝试在 firebase 托管中部署此应用程序,但失败了。Sveltekit 在文件夹下生成生产版本.svelte-kit。我尝试将public对象值更改为".svelte-kit"来自firebase.json文件,但它返回错误,例如没有 index.html 和 404.html。我们需要改变什么才能firebase.json让它发挥作用?
{
"hosting": {
"public" : "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
Run Code Online (Sandbox Code Playgroud) 我的应用程序使用用户当前的位置和地址详细信息,完成我的应用程序后,我将其上传到 Play 商店,它运行良好,我发布了三到四个版本,没有任何问题。上周我上传了一个 APK,但被 google play 控制台拒绝,我收到以下错误
然后我将后端 api 调用从 http:// 更改为 https:// 然后我在登录屏幕中添加了隐私政策,一旦我确认它运行良好,然后我再次上传到 Play 商店,应用程序再次被拒绝。
我在谷歌上搜索了这个错误,但仍然没有得到任何解决方案来解决这个问题。
请帮助修复它
我正在RecyclerView与Grid layout. 一切正常。但我需要在水平中心设置列。例如。我有 18 个项目,跨度数为 4。对于最后一行,我有 2 个项目。这两个项目应该在水平中心而不是左边。
这是我的RecyclerView:
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:overScrollMode="never"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
android:layout_gravity="center_horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rv_answer" />
Run Code Online (Sandbox Code Playgroud)
这是我的adapter layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_marginStart="@dimen/marginVSmall"
android:layout_marginEnd="@dimen/marginVSmall"
android:layout_marginTop="@dimen/marginVSmall"
android:layout_marginBottom="@dimen/marginVSmall"
android:layout_height="wrap_content">
<curvegraph.com.vijay.widgets.SquareTextView
android:id="@+id/tv_option"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/circle"
android:gravity="center"
android:text="A"
android:textStyle="bold"
android:maxLength="1"
android:textColor="@color/colorWhite"
android:textSize="@dimen/textXLarge"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
我要设置的 Kotlin 代码 LayoutManager
rv_option.layoutManager = GridLayoutManager(this, 4)
Run Code Online (Sandbox Code Playgroud)
这是我的 Kotlin 代码:
val grid = GridLayoutManager(this, 8)
grid.spanSizeLookup = …Run Code Online (Sandbox Code Playgroud) android ×2
firebase ×2
reactjs ×2
cryptography ×1
google-play ×1
javascript ×1
kotlin ×1
material-ui ×1
node-modules ×1
node.js ×1
svelte ×1
svelte-3 ×1
sveltekit ×1
webpack ×1