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]: 同时开启bff和ssg,build报错 #5929

Closed
ejfkdev opened this issue Jul 10, 2024 · 1 comment
Closed

[Bug]: 同时开启bff和ssg,build报错 #5929

ejfkdev opened this issue Jul 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ejfkdev
Copy link

ejfkdev commented Jul 10, 2024

版本信息

System:
    OS: macOS 14.5
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 1.03 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 126.0.6478.127
    Edge: 126.0.2592.87
    Safari: 17.5
  npmPackages:
    @modern-js/app-tools: 2.54.6 => 2.54.6 
    @modern-js/eslint-config: 2.54.6 => 2.54.6 
    @modern-js/plugin-bff: 2.54.6 => 2.54.6 
    @modern-js/plugin-express: 2.54.6 => 2.54.6 
    @modern-js/plugin-ssg: 2.54.6 => 2.54.6 
    @modern-js/plugin-tailwindcss: 2.54.6 => 2.54.6 
    @modern-js/runtime: 2.54.6 => 2.54.6 
    @modern-js/tsconfig: 2.54.6 => 2.54.6

问题详情

同时开启bff和ssg,会导致/api里的ts文件在build时出现语法识别错误

开启ssg后build不能识别import和export的语法,但能正常运行dev模式,关闭ssg后可以正常build

前端是个很简单的可以静态化的页面,只是需要调用一个api,不知道是框架兼容问题还是本身设计就不支持这样使用

export default async () => ({
^^^^^^

SyntaxError: Unexpected token 'export'

复现链接

http://localhost

复现步骤

mkdir myapp && cd myapp
npx @modern-js/create@latest

pnpm run new 开启bff和ssg
pnpm run dev 正常
pnpm run bulid 报错

@ejfkdev ejfkdev added the bug Something isn't working label Jul 10, 2024
@yimingjfe
Copy link
Member

yimingjfe commented Jul 10, 2024

The issue was fixed by #5909, we will release the fix tomorrow, please upgrade to the latest version tomorrow.

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

2 participants