It looks like you are trying to use glob syntax (i.e. “*“) with esbuild?

简介: It looks like you are trying to use glob syntax (i.e. “*“) with esbuild?

目录


问题


运行esbuild编译携带通配符的路径或文件时,可能存在如下错误。


It looks like you are trying to use glob syntax (i.e. "*") with esbuild. This syntax is typically handled by your shell, and isn't handled by esbuild itself. You must expand glob syntax first before passing your paths to esbuild.

image.png

错误场景


我在使用esbuild编译某

个文件夹下的所有文件。

package.json的scripts存在以下片段:

image.png

执行编译时提示无法处理携带通配符的路径src/**:

image.png

解决


可能需要将shell从 /bin/cmd 设置为 /bin/bash

npm config set script-shell /bin/bash

以windows为例子,此处的 /bin/bash 可以是你git安装目录下的bash.exe。

比如我的git安装在 D:\Dev\Git。

则我应该设置:

npm config set script-shell "D:\\Dev\\Git\\bin\\bash.exe"

再次执行,成功:

image.png

注意


可能会影响其他项目的运行。

届时可以设置回来:

npm config delete script-shell

当然也可以只对当前项目生效,不去修改全局的npm script运行:

npm config set script-shell "D:\\Dev\\Git\\bin\\bash.exe" --userconfig ./.npmrc

尾言


如果觉得文章对你有帮助的话,欢迎点赞收藏哦,有什么错误或者意见建议也可以留言,感谢~

相关文章
Python模块——glob模块详解
Python模块——glob模块详解
Python模块——glob模块详解
|
5月前
又被ESLint 调戏了!!! ESLint:Newline required at end of file but not found. eslint(eol-last) [12, 22]
又被ESLint 调戏了!!! ESLint:Newline required at end of file but not found. eslint(eol-last) [12, 22]
|
5月前
|
JavaScript
解决Vue项目报错:Expected indentation of 2 spaces but found 4. eslint(indent) [8, 1]的方法
解决Vue项目报错:Expected indentation of 2 spaces but found 4. eslint(indent) [8, 1]的方法
|
9月前
|
JavaScript
vite无法使用require,require is not defined
vite无法使用require,require is not defined
373 0
|
10月前
|
JavaScript 编译器
‘defineProps‘ is not defined.eslint no-undef 问题解决
‘defineProps‘ is not defined.eslint no-undef 问题解决
|
11月前
|
JavaScript
Vue3报错:Parsing error: No Babel config file detected 解决
Vue3报错:Parsing error: No Babel config file detected 解决
182 0
|
11月前
|
Unix Shell C++
Makefile中wildcard函数的应用理解
Makefile中wildcard函数的应用理解
224 0
SipStack.i:321: Error: Unknown SWIG preprocessor directive:
SipStack.i:321: Error: Unknown SWIG preprocessor directive:
57 0
Vite 踩坑 —— require is not defined
Vite 踩坑 —— require is not defined
Stylus - 方法(Functions)
Stylus - 方法(Functions)
65 0
Stylus - 方法(Functions)

热门文章

最新文章