Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(en): merge webpack.js.org/master into webpack.js.org/cn @ e8c2f876 #1606

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@
]
},
"devDependencies": {
"@babel/core": "^7.18.5",
"@babel/core": "^7.18.6",
"@babel/eslint-parser": "^7.18.2",
"@babel/plugin-proposal-class-properties": "^7.17.12",
"@babel/preset-env": "^7.18.2",
"@babel/preset-react": "^7.17.12",
"@babel/preset-env": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@mdx-js/loader": "^2.0.0-next.9",
"@octokit/auth-action": "^1.3.3",
"@octokit/rest": "^18.12.0",
Expand All @@ -89,15 +89,15 @@
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.1",
"css-minimizer-webpack-plugin": "^4.0.0",
"cypress": "^10.2.0",
"cypress": "^10.3.0",
"directory-tree": "^3.3.0",
"directory-tree-webpack-plugin": "^1.0.3",
"duplexer": "^0.1.1",
"eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-mdx": "^2.0.0",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-mdx": "^2.0.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"front-matter": "^4.0.2",
"github-slugger": "^1.4.0",
Expand All @@ -106,8 +106,8 @@
"http-server": "^14.1.1",
"husky": "^8.0.1",
"hyperlink": "^5.0.4",
"jest": "^28.1.1",
"lint-staged": "^13.0.2",
"jest": "^28.1.2",
"lint-staged": "^13.0.3",
"lodash": "^4.17.21",
"markdownlint": "^0.26.0",
"markdownlint-cli": "^0.31.1",
Expand All @@ -132,7 +132,7 @@
"remark-refractor": "montogeek/remark-refractor",
"rimraf": "^3.0.2",
"sass": "^1.53.0",
"sass-loader": "^13.0.0",
"sass-loader": "^13.0.2",
"sirv-cli": "^2.0.2",
"sitemap-static": "^0.4.2",
"static-site-generator-webpack-plugin": "^3.4.1",
Expand All @@ -145,7 +145,7 @@
"webpack": "^5.73.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.9.2",
"webpack-dev-server": "^4.9.3",
"webpack-merge": "^5.8.0",
"workbox-webpack-plugin": "^6.5.3"
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/Navigation/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,13 @@ function Navigation({ links, pathname, hash = '', toggleSidebar }) {
{link.children.map((child) => {
const classNames =
'text-blue-400 py-5 text-sm capitalize hover:text-black dark:hover:text-white';
const isActive = location.pathname.startsWith(child.url);
return (
<NavLink
key={child.url}
to={child.url}
title={child.title}
className={({ isActive }) =>
className={() =>
isActive
? `!text-black dark:!text-white ${classNames}`
: classNames
Expand Down
16 changes: 16 additions & 0 deletions src/content/api/module-methods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,20 @@ const page = 'Foo';
__webpack_modules__[require.resolveWeak(`./page/${page}`)];
```

<<<<<<< HEAD
T> `require.resolveWeak` 是_通用渲染_(服务器端渲染 SSR + 代码分割 Code Splitting)的基础。例如在 [react-universal-component](https://github.com/faceyspacey/react-universal-component) 等包中的用法。它允许代码在服务器端和客户端初始页面的加载上同步渲染。它要求手动或以某种方式提供 chunk。它可以在不需要指示应该被打包的情况下引入模块。它与 `import()` 一起使用,当用户导航触发额外的导入时,它会被接管。
=======
T> `require.resolveWeak` is the foundation of _universal rendering_ (SSR + Code Splitting), as used in packages such as [react-universal-component](https://github.com/faceyspacey/react-universal-component). It allows code to render synchronously on both the server and initial page-loads on the client. It requires that chunks are manually served or somehow available. It's able to require modules without indicating they should be bundled into a chunk. It's used in conjunction with `import()` which takes over when user navigation triggers additional imports.

### warning

If the module source contains a require that cannot be statically analyzed, critical dependencies warning is emitted.

Example code:

```javascript
someFn(require);
require.bind(null);
require(variable);
```
>>>>>>> e8c2f8766db26703149c39ab39766d378779a02e
2 changes: 1 addition & 1 deletion src/content/concepts/module-federation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export function set(value) {
const publicPath = await import('remote/public-path');
publicPath.set('/your-public-path');

//boostrap app e.g. import('./boostrap.js')
//bootstrap app e.g. import('./bootstrap.js')
```

### Infer publicPath from script $#inferpublicpathfromscript$
Expand Down
Loading