Closed ejfkdev closed 3 months ago
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 报错
The issue was fixed by https://github.com/web-infra-dev/modern.js/pull/5909, we will release the fix tomorrow, please upgrade to the latest version tomorrow.
版本信息
问题详情
同时开启bff和ssg,会导致/api里的ts文件在build时出现语法识别错误
开启ssg后build不能识别import和export的语法,但能正常运行dev模式,关闭ssg后可以正常build
前端是个很简单的可以静态化的页面,只是需要调用一个api,不知道是框架兼容问题还是本身设计就不支持这样使用
复现链接
http://localhost
复现步骤
mkdir myapp && cd myapp npx @modern-js/create@latest
pnpm run new 开启bff和ssg pnpm run dev 正常 pnpm run bulid 报错