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

[Refactor]: Document #618

Merged
merged 15 commits into from
Feb 25, 2021
Merged

[Refactor]: Document #618

merged 15 commits into from
Feb 25, 2021

Conversation

SoloJiang
Copy link
Contributor

  • 重构 document 方案
  • HTML 生成逻辑和工程配置解耦 - 支持 hash 等配置
  • MPA 模式无需 src/app.js
  • SSR 支持 build.json 配置 hash

@@ -79,7 +79,9 @@ module.exports = function (api) {
// Remove outputDir when start devServer
const { outputDir = 'build' } = userConfig;
configs.forEach((config) => {
fs.emptyDirSync(path.resolve(rootDir, outputDir, config.name));
if (config.name) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加一下注释

export default class LocalBuilderPlugin {
apply(compiler) {
compiler.hooks.shouldEmit.tap(PLUGIN_NAME, (compilation) => {
emit(compilation.assets);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释加一下

const { appConfig } = options || {};
if (!appConfig.router) {
appConfig.router = {};
}
appConfig.router.type = 'static';
return renderInServer(context, props, options);
return await renderInServer(context, props, options);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

核对一下变动

@@ -79,7 +79,9 @@ module.exports = function (api) {
// Remove outputDir when start devServer
const { outputDir = 'build' } = userConfig;
configs.forEach((config) => {
fs.emptyDirSync(path.resolve(rootDir, outputDir, config.name));
if (config.name) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

内置任务哪个链路不会设置 name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

document 没设置,我设置下也行

"chalk": "^4.1.0",
"html-minifier": "^4.0.0",
"cheerio": "1.0.0-rc.3"
"webpack": "^4.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个依赖应该是可以移除的,底层 build-scripts 已经依赖了,如果 plugin-rax-web 有用到内置 webpack 插件的,可以从 context 上取

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已删除,是之前的依赖

let localBuildTask = registerListenTask();

compiler.hooks.emit.tapAsync(PLUGIN_NAME, async (compilation, callback) => {
localBuildTask.then((localBuildAssets) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localBuildTask 是不是可以在 emit 阶段获取最新的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的

@SoloJiang SoloJiang merged commit 352506c into release-next Feb 25, 2021
@SoloJiang SoloJiang deleted the refactor/document branch February 25, 2021 08:34
SoloJiang added a commit that referenced this pull request Feb 26, 2021
* chore: bump version

* fix: data prefetches do not decamelize (#616)

* [Refactor]: Document (#618)

* chore: bump version

* feat: support mpa spm (#591)

* feat: support global css file in mpa (#592)

* refactor: enhance ssr in SPA mode (#590)

* fix: ssr document mode error

* chore: add test case

* fix: midway plugin ssr

* feat: support getInitialData

* fix: page component getInitial props in spa

* chore: add window fallback

* chore: optimize code

* feat: support no document

* feat: add document builder

* chore: add local build plugin

* chore: add emit

* feat: no document with staticExport

* feat: support hash in ssr

* chore: revert example

* chore: optimize code

* chore: remove useless code

* fix: app json content watch (#612)

* Bump version (#620)

* chore: bump version

* chore: add changelog

* chore: update version

* chore: update version

Co-authored-by: 岭伊 <zhengwang2314@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants