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

[Bug Report]: 通过脚本运行出现错误 #1295

Open
LovePlayCode opened this issue May 9, 2024 · 2 comments
Open

[Bug Report]: 通过脚本运行出现错误 #1295

LovePlayCode opened this issue May 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@LovePlayCode
Copy link

Steps to reproduce

import { BaseBundler, BaseBundlerBuildOpts, BaseBundlerOpts } from "./BaseBundler";
import { build, Server, logger, Compiler } from '@farmfe/core';
// import react from '@farmfe/plugin-react';

interface FarmOpts extends BaseBundlerOpts {
}

export class Farm extends BaseBundler {
constructor(opts: FarmOpts) {
super(opts);
}

async build(_opts: BaseBundlerBuildOpts = {}) {
const buildOpts = {
root: this.opts.root,
plugins: [
// react,
],
};
await build(buildOpts);
}

async dev(_opts: BaseBundlerBuildOpts = {}) {
const buildOpts = {
root: this.opts.root,
output: {
publicPath: '/',
},
};
let compiler = new Compiler({
config: buildOpts,
jsPlugins: [
// react,
],
rustPlugins: [],
});
let server = new Server({
compiler,
logger,
});
await server.createServer({
// @ts-ignore
hmr: {
port: 3000,
host: '0.0.0.0',
},
port: 3000,
host: '0.0.0.0',
});
server.listen();
}
}

Reproduce link

No response

What is actually happening?

正常编译
这个是错误图片
image

System Info

System: macos
Farm/core: 1.1.4
@LovePlayCode LovePlayCode changed the title [Bug Report]: 通过脚本运行出现吹哦 [Bug Report]: 通过脚本运行出现错误 May 9, 2024
@wre232114 wre232114 added the bug Something isn't working label May 9, 2024
@wre232114
Copy link
Member

我们看一下

@ErKeLost
Copy link
Member

ErKeLost commented May 9, 2024

尝试用一下 resolveConfig 这个方法把options 传进去,然后在传入 compiler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants