我确实在我的 nextjs 应用程序中使用了反冲力。但是,如果我接下来运行(在开发或生产中没有区别),我会收到以下错误消息:
重复的原子键“companyData”。这是生产中的致命错误。但如果由于热模块更换而发生此警告,则可以安全地忽略此警告。
这是我实现它的方式:
/src/stores/CompanyStore.js:
import { useSetRecoilState, useRecoilValue , atom } from 'recoil';
import config from '../../content/config.yml';
const companyData = atom({
key: 'companyData',
default: {...config.company},
});
export const useSetCompanyData = () => useSetRecoilState(companyData);
export const useCompanyData = () => useRecoilValue(companyData);
export default {
useSetCompanyData,
useCompanyData,
};
Run Code Online (Sandbox Code Playgroud)
我在某些组件中这样使用它:
我的组件.js
import React from 'react';
...
...
import {useCompanyData} from '../stores/CompanyStore';
const MyComponent = () => {
const classes = useStyles();
const companyData = useCompanyData();
const { summary: headline, description …Run Code Online (Sandbox Code Playgroud) 我用以下命令配置了php:
./configure \
--prefix=/opt/phpfcgi-5.3.28 \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir=/usr/include/freetype2 \
--with-libpng-dir=/usr/include/libpng \
--with-xpm-dir=/usr \
--enable-mbstring \ls \
--with-libxml-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-mysql-dir=/etc/mysql/ \
--with-pdo-mysql \
--with-mysqli \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--with-libdir=/lib/x86_64-linux-gnu \
--enable-ftp \
--with-kerberos \ …Run Code Online (Sandbox Code Playgroud) 我在本地主机上有一个 mysql 数据库。现在我想安装一些需要空数据库的 Web 应用程序(例如“myapplication”)。
如何在 PhpStorm 9 中创建这样的数据库?
我确实将material-ui 与nextjs 一起使用。在material-ui的文档中,我找到了关于实现material-ui的#the-client-side :
function Main() {
React.useEffect(() => {
const jssStyles = document.querySelector('#jss-server-side');
if (jssStyles) {
jssStyles.parentElement.removeChild(jssStyles);
}
}, []);
return (
<ThemeProvider theme={theme}>
<App />
</ThemeProvider>
);
}
Run Code Online (Sandbox Code Playgroud)
我想知道这是否是一个好的工作流程,因为所有生成的样式都会发送到客户端,并且只会与那里的 DOM 解耦。
在构建过程中删除它们 - 或者使用其他方式 - 这样样式至少不会发送给客户端不是更好吗?
顺便说一句: 我已将生成的样式复制到单独的文件中以检查文件大小。不必要的传输样式> 30kb!
如果您使用项目,其他开发人员在使用Windows Eclipse安装(cp1250)上的默认设置之前...您可以做些什么来清除您的Linux安装eclipse?
或者,如果您仍然在Linux上工作,而其他开发人员在Windows上工作,并且不想更改那些设置?
我目前正在使用require.context加载所有.vue文件名不以Async.
const loadComponents = (Vue) => {
const components = require.context('@/components', true, /\/[A-Z](?!\w*Async\.vue$)\w+\.vue$/);
components.keys().forEach((filePath) => {
const component = components(filePath);
const componentName = path.basename(filePath, '.vue');
// Dynamically register the component.
Vue.component(componentName, component);
});
};
Run Code Online (Sandbox Code Playgroud)
现在我想加载以Asyncwith结尾的组件,require.context这样我就不必在创建这种类型的新组件时手动添加它们。
通常动态导入语法如下所示:
Vue.component('search-dropdown', () => import('./search/SearchDropdownAsync'));
Run Code Online (Sandbox Code Playgroud)
这将通过承诺解决并动态导入组件。
出现的问题是,当您使用 时require.context,它会立即加载(需要)组件,而我无法使用动态导入。
有什么办法可以结合require.contextWebpack的动态导入语法吗?
https://webpack.js.org/guides/code-splitting/#dynamic-imports
我尝试将我的应用程序服务从 git localrep 从 azure 平台克隆到本地环境(在 PC 上)。但当我这样做时
git clone < https://adminusername@my.azure.url.torepo/appser.git>
Run Code Online (Sandbox Code Playgroud)
控制台询问我使用管理员用户名登录进行身份验证。但密码是多少?它不是 MicrosoftAppPassword,当我尝试使用它时,身份验证失败。
密码是什么?
升级react-native-navigationreact-native-safe-area-context后尝试升级时出现以下错误
Note: Recompile with -Xlint:deprecation for details.
e: /home/me/myProject/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaUtils.kt: (12, 34): Unresolved reference: R
e: /home/me/myProject/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaUtils.kt: (15, 34): Unresolved reference: getInsets
e: /home/me/myProject/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaUtils.kt: (16, 24): Unresolved reference: Type
e: /home/me/myProject/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaUtils.kt: (17, 28): Unresolved reference: Type
e: /home/me/myProject/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaUtils.kt: (18, 28): Unresolved reference: Type
e: /home/me/myProject/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaUtils.kt: (55, 50): Unresolved reference: R
e: /home/me/myProject/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.kt: (8, 37): Unresolved reference: FabricViewStateManager
e: /home/me/myProject/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.kt: (9, 37): Unresolved reference: FabricViewStateManager
e: /home/me/myProject/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.kt: (19, 66): Unresolved reference: HasFabricViewStateManager
e: /home/me/myProject/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.kt: (24, 41): Unresolved reference: FabricViewStateManager
e: …Run Code Online (Sandbox Code Playgroud) 我没有使用GitLab CI的经验.所以我选择使用node.js(https://about.gitlab.com/gitlab-ci/#gitlab-runner)并将其安装在我的本地机器上.
我gcr在安装成功完成后运行.比我输入GitLabCI-URL和我的GitLab CI注册令牌.
在此之后我收到了十几次这条消息:
gcr info [client] checking for builds...
gcr http 404 https://ci.gitlab.com/api/v1/builds/register.json
gcr info [client] checking for builds...
gcr http 404 https://ci.gitlab.com/api/v1/builds/register.json
Run Code Online (Sandbox Code Playgroud)
如果我在浏览器中输入上述URL,则控制台会显示以下消息:
无法加载资源:服务器响应状态为405(方法不允许)
任何人都可以帮助我获得GitLab CI和node.js连接的第一步吗?
我使用 nextjs 创建了一个网页,并用于next export创建它的静态页面。我想知道为什么输出目录中存在巨大文件大小的文件(请参阅:
)
如果我将其上传到服务器并在浏览器中运行,该页面会非常快。看来至少 - 即使文件_app.js和_index.js存在于该目录中 - 它们不被实时页面使用。
但我想知道为什么它们如此之大,以及如果生产不需要它们为什么会在输出目录中?
--
我使用“Webpack Bundle Analyzer”分析了该捆绑包,但仍然不明白造成如此巨大文件大小的原因是什么:

--
我从 github 创建了一个小项目,并运行,next build并且输出目录中根本next export没有_app.js或_error.js,但只有文件名中带有随机字符串的项目!
那么这可能取决于我的环境配置错误吗?
next.js ×3
azure ×1
azure-devops ×1
database ×1
eclipse ×1
git ×1
gitlab-ci ×1
javascript ×1
linux ×1
material-ui ×1
node.js ×1
php ×1
phpstorm ×1
react-native ×1
reactjs ×1
recoiljs ×1
utf-8 ×1
vue.js ×1
webpack ×1
windows ×1