I have observed that This error only occurs in windows, not in ubuntu
To resolve this error
You can modify the package.josn file script tag
"scripts": {
"build": "npm run build-cjs && npm run build-esm && npm run ts-types",
"build-cjs": "babel src --extensions \".ts,.tsx,.js,.jsx\" --copy-files --out-dir lib",
"build-clean": "npm run clean && npm run build",
"build-esm": "BABEL_OUTPUT=esm babel src --extensions \".ts,.tsx,.js,.jsx\" --copy-files --out-dir esm",
"dev": "BABEL_OUTPUT=esm babel src --extensions \".ts,.tsx,.js,.jsx\" --watch --copy-files --out-dir esm",
"prebuild": "rimraf {lib,esm,tsconfig.tsbuildinfo}",
"postbuild": "npm run test",
"ts-types": "tsc --build",
"test": "jest"
}
TO
"scripts": {
"build": "npm run build-cjs && npm run build-esm && npm run ts-types",
"build-cjs": "babel src --extensions \".ts,.tsx,.js,.jsx\" --copy-files --out-dir lib",
"build-clean": "npm run clean && npm run build",
"build-esm": "set BABEL_OUTPUT=esm babel src --extensions \".ts,.tsx,.js,.jsx\" --copy-files --out-dir esm",
"dev": "set BABEL_OUTPUT=esm babel src --extensions \".ts,.tsx,.js,.jsx\" --watch --copy-files --out-dir esm",
"prebuild": "rimraf {lib,esm,tsconfig.tsbuildinfo}",
"postbuild": "npm run test",
"ts-types": "tsc --build",
"test": "jest"
}
change part
"build-esm": "set BABEL_OUTPUT=esm babel src --extensions \".ts,.tsx,.js,.jsx\" --copy-files --out-dir esm",
"dev": "set BABEL_OUTPUT=esm babel src --extensions \".ts,.tsx,.js,.jsx\" --watch --copy-files --out-dir esm",
And then Try to build it will work.