简体   繁体   English

package.json的构建脚本

[英]Build script of package.json

I have the below folder structure 我有以下文件夹结构

-src
--module
---some.js
---another.js
--server.js

I am using parceljs transpile the .js files 我正在使用parceljs转换.js文件

The script in package.json looks like this package.json的脚本如下所示

"build": "parcel src/*/*.js --target=node"

When I run npm run build , server.js is not transpiled. 当我运行npm run buildserver.js不会被编译。

If I change the build script to the below, files in module folder don't get transpiled 如果我将构建脚本更改为以下内容,则不会编译module文件夹中的文件

"build": "parcel src/*.js --target=node"

Any guidance so what I could transpile .js files in the src level as well as all nested files? 有什么指导,以便我可以在src级别转换.js文件以及所有嵌套文件吗?

您可以使用逻辑运算符&&在同一行中运行两个命令:

"build": "parcel src/*.js --target=node && parcel src/*/*.js --target=node"

根据@Jeremy的建议parcel src/**/*.js --target=node 。js parcel src/**/*.js --target=node

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM