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

fix: 适配commonjs(for ssr) 构建 #1109

Merged
merged 3 commits into from
May 6, 2024
Merged

fix: 适配commonjs(for ssr) 构建 #1109

merged 3 commits into from
May 6, 2024

Conversation

Jinbao1001
Copy link
Member

@Jinbao1001 Jinbao1001 commented Apr 29, 2024

  1. commonjs 构建所需参数由用户传入
  2. 固定的输出目录由用户自定义, 缺省时使用 dist
  3. 用户钩子函数优先执行
  4. 目录调整后路径 bug 修复

Summary by CodeRabbit

  • 新功能

    • 添加了基于 opts.config.outputPath 或默认路径的新 outputPath 变量。
    • 更新了路径,使用新的 outputPath 变量代替硬编码的路径。
    • getOkamConfig 中引入了新的配置选项 cjsdynamicImportToRequireplatform
  • 导出或公共实体声明的更改

    • exports.build 函数:

      • 添加了 const outputPath = path.resolve(opts.cwd, opts.config.outputPath || 'dist');
      • 更新了 statsJsonPath,使用 outputPath 替代硬编码的路径。
    • exports.dev 函数:

      • 添加了 const outputPath = path.resolve(opts.cwd, opts.config.outputPath || 'dist');
      • 更新了 app.use(express.static(...)),使用 outputPath 替代硬编码的路径。
    • getOkamConfig 函数:

      • 添加了 let platform = 'browser'; if (webpackConfig.target === 'node') platform = 'node';
      • 添加了新的配置选项 cjsdynamicImportToRequireplatform

@Jinbao1001 Jinbao1001 requested a review from sorrycc April 29, 2024 10:10
Copy link
Contributor

coderabbitai bot commented Apr 29, 2024

概述

整体变更涉及项目结构或模块层次的重新组织。在 bundler-okam 包的 index.js 文件中,引入了新的配置选项和路径变量,包括添加了基于 opts.config.outputPath 或默认路径的新 outputPath 变量,更新了路径以使用新的 outputPath 变量而不是硬编码,并在 getOkamConfig 中引入了新的配置选项 cjsdynamicImportToRequireplatform

变更

文件路径 变更摘要
packages/bundler-okam/index.js - 添加了新的 outputPath 变量,基于 opts.config.outputPath 或默认路径。
- 更新了路径以使用新的 outputPath 变量而不是硬编码。
- 在 getOkamConfig 中引入了新的配置选项 cjsdynamicImportToRequireplatform

诗歌

兔子编码忙调整,项目结构变得更美妙,路径变量新添加,配置选项如春风拂面,代码如诗般飘逸,变更如春日般温柔。 🐇✨

Note

Pull Request Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://coderabbit.ai


Commits Files that changed from the base of the PR and between 23ace7d and 57ec816.
Files selected for processing (1)
  • packages/bundler-okam/index.js (7 hunks)

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Jinbao1001 Jinbao1001 changed the title feat: 适配commonjs(for ssr) 构建 fix: 适配commonjs(for ssr) 构建 Apr 29, 2024
if (lessResult) {
return lessResult;
}
// user load first
Copy link
Member

Choose a reason for hiding this comment

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

user load first 有具体场景?比如要拦截 less 的处理?否则从功能上来看应该是一样的。

Copy link
Member Author

Choose a reason for hiding this comment

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

dumi会有less?dumi-raw

packages/bundler-okam/index.js Show resolved Hide resolved
packages/bundler-okam/index.js Show resolved Hide resolved
@Jinbao1001 Jinbao1001 requested a review from sorrycc April 30, 2024 06:35
@sorrycc sorrycc merged commit 52a52d5 into master May 6, 2024
8 checks passed
@delete-merged-branch delete-merged-branch bot deleted the jinbao/suit-ssr branch May 6, 2024 01:45
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.

2 participants