Git bash reports an error when using the yarn command to execute recursively (Win10)

Viewed 132

I'm using git bash develop my project on windows, but an error occured when I use yarn recursive commands.

$ yarn build
yarn run v1.22.10
$ yarn lint && rm -rf dist/test && yarn build:cjs && yarn build:umd:min
$ eslint .eslintrc.json --fix --color --cache --max-warnings=0 ./src
$ rm -rf dist/cjs && tsc src/index.ts --downlevelIteration --declaration --module commonjs --target es5 --outDir dist/cjs
$ yarn build:umd && uglifyjs --compress --mangle --source-map --ie8 --comments -o dist/umd/js-sdsl.min.js -- dist/umd/js-sdsl.js
$ yarn build:esm && rm -rf dist/umd && mkdir dist/umd && rollup dist/esm/index.js --format umd --name sdsl -o dist/umd/js-sdsl.js
$ rm -rf dist/esm && tsc src/index.ts --downlevelIteration --declaration --module es2015 --target es5 --outDir dist/esm
命令语法不正确。
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

My package.json scripts here.

{
  "scripts": {
    "setup": "rm -rf node_modules && yarn",
    "build": "yarn lint && rm -rf dist/test && yarn build:cjs && yarn build:umd:min",
    "build:cjs": "rm -rf dist/cjs && tsc src/index.ts --downlevelIteration --declaration --module commonjs --target es5 --outDir dist/cjs",
    "build:esm": "rm -rf dist/esm && tsc src/index.ts --downlevelIteration --declaration --module es2015 --target es5 --outDir dist/esm",
    "build:umd": "yarn build:esm && rm -rf dist/umd && mkdir dist/umd && rollup dist/esm/index.js --format umd --name sdsl -o dist/umd/js-sdsl.js",
    "build:umd:min": "yarn build:umd && uglifyjs --compress --mangle --source-map --ie8 --comments -o dist/umd/js-sdsl.min.js -- dist/umd/js-sdsl.js",
    "test": "rm -rf dist/test && tsc --downlevelIteration --declaration src/test.ts --module commonjs --target es5 --outDir dist/test && node ./dist/test/test.js",
    "lint": "eslint .eslintrc.json --fix --color --cache --max-warnings=0 ./src",
    "deploy": "yarn build:umd:min && typedoc src/type.ts && mv dist/umd/* docs && gh-pages -d docs"
  },
}

But when I expand the command it works fine.

$ yarn lint && rm -rf dist/test && rm -rf dist/cjs && tsc src/index.ts --downlevelIteration --declaration --module commonjs --target es5 --outDir dist/cj && rm -rf dist/esm && tsc src/index.ts --downlevelIteration --declaration --module es2015 --target es5 --outDir dist/esm && rm -rf dist/umd && mkdir dist/umd && rollup dist/esm/index.js --format umd --name sdsl -o dist/umd/js-sdsl.js && uglifyjs --compress --mangle --source-map --ie8 --comments -o dist/umd/js-sdsl.min.js -- dist/umd/js-sdsl.js
yarn run v1.22.10
$ eslint .eslintrc.json --fix --color --cache --max-warnings=0 ./src
Done in 21.30s.

dist/esm/index.js → dist/umd/js-sdsl.js...
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
dist\esm\Vector\Vector.js
1: var __generator = (this && this.__generator) || function (thisArg, body) {
                      ^
2:     var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
3:     return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
...and 7 other occurrences
dist\esm\Deque\Deque.js
1: var __generator = (this && this.__generator) || function (thisArg, body) {
                      ^
2:     var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
3:     return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
...and 1 other occurrence
dist\esm\LinkList\LinkList.js
1: var __generator = (this && this.__generator) || function (thisArg, body) {
                      ^
2:     var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
3:     return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
...and 1 other occurrence

...and 4 other files
created dist/umd/js-sdsl.js in 558ms

My project js-sdsl here: https://github.com/ZLY201/js-sdsl.

I'm wondering if this is any known bug in git bash, or a problem with my configuration?

0 Answers
Related