Skip to content

Commit

Permalink
docs(main): remove plugin-i18n case
Browse files Browse the repository at this point in the history
  • Loading branch information
KyrieLii committed Feb 1, 2024
1 parent 43a6cee commit f577b05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ Modern.js will help you automatically register the plugin by following these ste
1. Modern.js maintains an official list of plugins internally.

```js
const InternalPlugins = ['@modern-js/app-tools', '@modern-js/plugin-i18n', ...];
const InternalPlugins = ['@modern-js/app-tools', '@modern-js/plugin-tailwindcss', ...];
```

2. Modern.js will read your `package.json` and collect the dependency information.

```json title="package.json"
"dependencies": {
"@modern-js/plugin-i18n": "x.x.x"
"@modern-js/plugin-tailwindcss": "x.x.x"
...
},
"devDependencies": {
Expand All @@ -55,7 +55,7 @@ const InternalPlugins = ['@modern-js/app-tools', '@modern-js/plugin-i18n', ...];
}
```

3. Modern.js observes that when you install dependencies such as `@modern-js/plugin-i18n` and `@modern-js/app-tools`, automatic plugin registration will be imported.
3. Modern.js observes that when you install dependencies such as `@modern-js/plugin-tailwindcss` and `@modern-js/app-tools`, automatic plugin registration will be imported.

You can notice that this approach is relatively black-box and you are not even aware of the process of loading the plugin. We want to expose more details to the developer and be able to let the developer control the process.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ Modern.js 将通过以下几个步骤帮你自动注册插件
1. Modern.js 在内部维护一份官方插件列表。

```js
const InternalPlugins = ['@modern-js/app-tools', '@modern-js/plugin-i18n', ...];
const InternalPlugins = ['@modern-js/app-tools', '@modern-js/plugin-tailwindcss', ...];
```

2. Modern.js 将读取你的 `package.json` 文件,收集依赖信息。

```json title="package.json"
"dependencies": {
"@modern-js/plugin-i18n": "x.x.x"
"@modern-js/plugin-tailwindcss": "x.x.x"
...
},
"devDependencies": {
Expand All @@ -55,7 +55,7 @@ const InternalPlugins = ['@modern-js/app-tools', '@modern-js/plugin-i18n', ...];
}
```

3. Modern.js 观察到你安装了 `@modern-js/plugin-i18n``@modern-js/app-tools` 等依赖后,将会引入插件自动注册。
3. Modern.js 观察到你安装了 `@modern-js/plugin-tailwindcss``@modern-js/app-tools` 等依赖后,将会引入插件自动注册。

可以注意到这种方式相对黑盒,你甚至对加载插件的过程是无感知的。我们希望更多的细节暴露给开发者,能让开发者去控制这一过程。

Expand Down

0 comments on commit f577b05

Please sign in to comment.