Git Product home page Git Product logo

Comments (7)

Zourunfa avatar Zourunfa commented on May 20, 2024 1

O(∩_∩)O
我是这么追溯的
先看到这个文件的绝对路径 被core下面的config的 normalizeUserCompilationConfig 方法 放在了 config.runtime.plugins里面
image

然后 整个 normalizeUserCompilationConfig 返回的 config 对象都会被 Compiler 函数编译
image

然后 我打开Compiler定义的地方,主要用到了BindingCompiler类 编译config对象
image

再看BindingCompiler类 加载的是这个了 nativeBinding = require('./farm.win32-arm64-msvc.node')
image

我推测 ./farm.win32-arm64-msvc.node 是rust生成 的 但我不知道具体代码在哪

于是我无法在packages/runtime-plugin-hmr/src/index这个文件判断从哪拿到define: {
HMR_PORT: 9001
}

希望得到大哥指教

from farm.

Zourunfa avatar Zourunfa commented on May 20, 2024

最近我在看这块的代码 我发现这个hmr 的port 好像是能自定义的 我打印了一下在控制台 我能问一下是不是我理解错了,搞清楚问题 然后看能不能做一下这个
Recently, I was looking at this code and I noticed that the port of this HMR seems to be customizable. I printed it on the console and wanted to ask if I misunderstood it. I need to clarify the problem and see if I can do this
image

from farm.

wre232114 avatar wre232114 commented on May 20, 2024

这个是 server 部分的,是支持配置的,但是 client 的是写死的,你可以看 packages/runtime-plugin-hmr 下面的代码

from farm.

Zourunfa avatar Zourunfa commented on May 20, 2024

image
哦 需要向webpack这样是吗,client的 在devServer下新增一个 Client配置对象,然后下面有port ,host 属性可配置

from farm.

wre232114 avatar wre232114 commented on May 20, 2024

image
配置就是这样呢,只不过这个配置没有同步到 client 那一侧。我理解加一个 define 配置就可以实现这个功能了。

define: {
  HMR_PORT: 9001
}

在 runtime plugin hmr 里面:

const port = HMR_PORT;

from farm.

wre232114 avatar wre232114 commented on May 20, 2024

直接在 packages/runtime-plugin-hmr/src/index 中些 const port = HMR_PORT 就好了,编译时会自动注入

from farm.

wjq990112 avatar wjq990112 commented on May 20, 2024

或许 Boolean 也需要支持一下

from farm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.