doczjs / docz

✍ It has never been so easy to document your things!
https://docz.site
MIT License
23.61k stars 1.46k forks source link

Unknown compiler option 'jsxImportSource' issue.. #1642

Open leekeunhwan opened 3 years ago

leekeunhwan commented 3 years ago

Question

Hi

I want to use docz

Unknown compiler option 'jsxImportSource' and same issue occurs

As you use twin.macro in your project, in tsconfig 'jsxImportSource' I am using it by setting it to '@emotion/react'.

The above issue occurred and the build is not working, is there any solution?

I tried to change appTsConfig in doczrc, but it doesn't work.

I am also wondering if there is a way to operate it with a separate tsconfig or if there is a plug-in that can solve it.

스크린샷 2021-06-29 오후 2 38 41 스크린샷 2021-06-29 오후 2 38 58

adbayb commented 3 years ago

Same with the importsNotUsedAsValues TS config 😅 .

The root cause comes from the fact that the TypeScript runtime is specified as a direct dependency inside the docz-core package and is pretty old (3.5.3 vs the latest 4.3.5: jsxImportSource was introduced in 4.1).

@pedronauck Could we imagine to have typescript specified as a peer dependency? The config is defined consumer side and depends on the TypeScript version specified by the consumer. It would sense to do so (and will also avoid multiple typescript copies in the project :) )

leekeunhwan commented 3 years ago

@pedronauck How are we going to solve this problem? I want to use Docz soon

renatobenks commented 3 years ago

Thank you for the report guys! We're currently working to fully upgrade everything inside docz but we try can manage a quick fix to that earlier, and typescript is not a peer-dependency, we need it to build processes. But we'll figure a way out to fix that ASAP.

adbayb commented 3 years ago

@renatobenks Is it feasible to specify typescript as a devDependency? If yes, typescript will be available for your development needs (build process) without impacting consumer (dev dependencies are ignored while npm install consumer side).

renatobenks commented 3 years ago

Yes, totally! Let me check, because it should be as dev-dependency 🤔

renatobenks commented 3 years ago

However @adbayb, npm install actually install dev dependencies as well, as long as it's not with the —-prod within

adbayb commented 3 years ago

@renatobenks npm (or whatever node package manager) will install devDependencies of a given package when the package.json of this package is available locally in the current working directory (unless you set the --prod flag as you mentioned). However if the package is retrieved from a remote location (npm registry, git repository...), the prod flag is implicitly set (ie. no need to set it consumer side) and npm will only install the package dependencies (ignoring its devDependencies).

So, here:

renatobenks commented 3 years ago

Oh, I see what you mean now, sorry! 😅

Sure thing, can you send a PR and see what it got?

renatobenks commented 3 years ago

I'll be working on a few issues on docz today, so let me know @adbayb.

adbayb commented 3 years ago

@renatobenks Unfortunately not today but I can try to book some time tomorrow

renatobenks commented 3 years ago

Awesome! I just advise you to make sure that both rollup and lerna will keep working as properly because maybe, just maybe, that's why typescript is not a dev-dependency as it should.

adbayb commented 3 years ago

@renatobenks and @pedronauck : done ✅ Review needed https://github.com/doczjs/docz/pull/1647 🙏