web-infra-dev / modern.js

Modern.js is a web engineering system, including a web framework and a npm package solution.
https://modernjs.dev/en/
MIT License
4.4k stars 367 forks source link

[Bug]: Modern build failed when the buildPreset is npm component #4900

Closed fengjiling123 closed 10 months ago

fengjiling123 commented 11 months ago

版本信息

system: windows11
version: 2.34.0
pnpm version: 8.9.2
node version: 16.16.0

问题详情

image

复现链接

https://github.com/web-infra-dev/modern-js-examples

复现步骤

1.下载modern-js-examples 2.到basic-module下,将buildPreset改成npm-component 3.pnpm build 之后报错

HerringtonDarkholme commented 11 months ago

Hi, can you try these commands in a new project? https://ast-grep.github.io/guide/api-usage.html

pnpm add @ast-grep/napi
import { js } from '@ast-grep/napi';

const source = `console.log("hello world")`
const ast = js.parse(source)
const node = ast.root().find('console.log')

If the code example works, I would speculate the problem is pnpm.

HerringtonDarkholme commented 11 months ago

Can you list the content inside node_modules of https://github.com/ast-grep. Probably we need all directories inside there.

Example screenshot

image

fengjiling123 commented 11 months ago

image

fengjiling123 commented 11 months ago

This example also throws the same error. image

HerringtonDarkholme commented 11 months ago

This example also throws the same error.

Can you try listing the files under node_modules? Especially @ast-grep.

HerringtonDarkholme commented 11 months ago

I noticed you are using MinGW, can you try it without using MinGW?

10Derozan commented 10 months ago

If there are no other issues, this will be closed. @fengjiling123