parcel-plugin-typescript: "Error: Cannot find source file" when building on Windows
package.json:
{
"name": "index",
"version": "1.0.0",
"description": "",
"main": "index.html",
"scripts": {
"build": "parcel build index.html"
},
"devDependencies": {
"@types/react": "^16.0.37",
"@types/react-dom": "^16.0.4",
"autoprefixer": "^8.0.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"parcel-bundler": "^1.5.1",
"parcel-plugin-typescript": "^0.6.0",
"typescript": "^2.7.1"
},
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0"
}
}
index.html:
<html>
<body>
<div id="root"></div>
<script src="./Index.tsx"></script>
</body>
</html
tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"lib": ["dom", "es2015", "es2016", "es2017.object"],
"jsx": "preserve",
"target": "es2017",
"module": "es2015",
"moduleResolution": "node",
"strict": true,
"sourceMap": true,
"skipLibCheck": true,
"noEmitHelpers": true,
"importHelpers": true,
"baseUrl": ".",
"paths": {
"*": ["*"]
}
},
"parcelTsPluginOptions": {
"transpileOnly": false
}
}
.babelrc
{
"presets": ["env", "react"]
}
Index.tsx:
import React from "react";
import ReactDOM from "react-dom";
const App = () => <div>Hello World!</div>;
ReactDOM.render(<App />, document.getElementById("root"));
Running: parcel build index.html results in following error:
Error: Error: Error: Cannot find source file "C:\projects\parcel-ts\Index.tsx"
at TypeScriptCompiler.compile (C:\projects\parcel-ts\node_modules\parcel-plugin-typescript\build\backend\compiler\tsc.js:25:19)
at Object.<anonymous> (C:\projects\parcel-ts\node_modules\parcel-plugin-typescript\build\backend\worker\launcher.js:28:29)
at Generator.next (<anonymous>)
at fulfilled (C:\projects\parcel-ts\node_modules\tslib\tslib.js:104:62)
at <anonymous>
at TypeScriptWorker.<anonymous> (C:\projects\parcel-ts\node_modules\parcel-plugin-typescript\build\ipc\worker\index.js:27:19)
at Generator.next (<anonymous>)
at fulfilled (C:\projects\parcel-ts\node_modules\tslib\tslib.js:104:62)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at IncomingMessage.res.setEncoding.on (C:\projects\parcel-ts\node_modules\parcel-plugin-typescript\build\ipc\client.js:31:32)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (4 by maintainers)
Commits related to this issue
- fix(file-store): alias jsx virtual files Fixes #26 — committed to fathyb/parcel-plugin-typescript by fathyb 6 years ago
- fix(file-store): support Windows separators Fixes #26 — committed to fathyb/parcel-plugin-typescript by fathyb 6 years ago
- fix(file-store): support Windows separators Fixes #26 — committed to fathyb/parcel-plugin-typescript by fathyb 6 years ago
@severisv and @Vitegor : I confirm that I’m able to reproduce your bug. It only happens on Windows though.
Could you try
parcel-plugin-typescript@0.6.1-next.2? I tested it on Windows 10 with both of your reproductions and it works. If it doesn’t please check if you have the right version usingyarn listornpm ls.I can confirm that it works for me aswell. Thank you!
@fathyb, after update to
parcel-plugin-typescript@0.6.1-next.2build works, thanks