Parcel does not read jsconfig.json
only tsconfig.json
, even with @parcel/transformer-typescript-tsc
#9771
Labels
jsconfig.json
only tsconfig.json
, even with @parcel/transformer-typescript-tsc
#9771
🐛 bug report
I cannot get
parcel
to pick upjsconfig.json
using either the native Typescript transformer or@parcel/transform-typescript-tsc
as per previous issues reported by others and considered fixed in #6501:I am specifically trying to compile
*.js
files respecting thebaseUrl
andinclude
settings in ourjsconfig.json
to avoid having to rewrite everyimport
statement in the project to use leading~
or similar bare specifiers.When no
tsconfig.json
is present and only ajsconfig.json
,parcel
will not attempt to compile any files to TypeScript and ignores thejsconfig.json
. Whentsconfig.json
is present withcompilerOptions.allowJs = true
,parcel
correctly transforms the JS files respecting thebaseUrl
value and other directives intsconfig.json
. Even when*.{js,jsx}
files are configured to use@parcel/transform-typescript-tsc
, thejsconfig.json
is ignored.🎛 Configuration (.babelrc, package.json, cli command)
Project structure:
tsconfig.json
andjsconfig.json
are identicaljsconfig.json
should be discovered whentsconfig.json
is missingjsconfig.json
/tsconfig.json
minimally:package.json
minimally:.parcelrc
to enable compilation of JS files viatsc
:index.js
App.jsx
🤔 Expected Behavior
WHEN
jsconfig.json
is present andtsconfig.json
is NOTTHEN
parcel
should findsrc/App.jsx
andsrc/components/HelloWorld.jsx
by referring to thebaseUrl
specified injsconfig.json
😯 Current Behavior
THEN
parcel
complains about a missing dependency forApp
andcomponents
:💁 Possible Solution
Consider
jsconfig.json
for compiling JS files when TypeScript is enabled. Provide a configuration example of how to enable the native TypeScript compiler provided byparcel
for JS files that will consider thejsconfig.json
file.🔦 Context
I have a real world project that is using TypeScript for type hints during development but not full TypeScript features due to the volume of code in the project that we would have to convert. We consider JS files to be TS files in the IDE only, which is triggered by our existing
jsconfig.json
file.I would like to convert the codebase from CRA + Webpack +
react-scripts-rewired
to Parcel with minimal changes to the codebase, so prefixing everyimport
statement with/
(whichstandardjs
reports as a violation) or~
would exceed our "minimal changes" threshold. From the documentation, it appears thatparcel
SHOULD support bothjsconfig.json
andtsconfig.json
, just not both at the same time. However, in my numerous attempts, I cannot get either the native transformer nor@parcel/transformer-typescript-tsc
to recognizejsconfig.json
, onlytsconfig.json
.This isn't a huge blocker for us, as we can stand renaming
jsconfig.json
totsconfig.json
and adding theallowJs
flag.💻 Code Sample
See above.
🌍 Your Environment
The text was updated successfully, but these errors were encountered: