Closed FlatMapIO closed 6 years ago
Did you put the .tsx
extension at import?
import { Something } from './Something.tsx'`
I don't even know why this is mandatory on mdx 😞
Thanks @pedronauck , I tried it and got "Module parse failed: Unexpected token (3:21) You may need an appropriate loader to handle this file type." message
You need to enable typescript via CLI --typescript
or your docz config file.
docz using babel7 compile tsx, It does not support const enum
, So i can't use it for now .
Thanks @albinekb .
You can modify your bundler config to use ts-loader
instead of babel plugin @huodon
export default {
modifyBundlerConfig: (config) => {
/* set ts-loader here */
return config
}
}
Thank you @pedronauck , the problem was solved. 👍
@huodon How did you use ts-loader
instead? I tried and I failed. Mind showing the essential parts of your config?
@cvle if you want to use ts-loader
you can just docz-plugin-babel6 that implements ts-loader together with babel 6 ✌️
if i want to use ts-loader with options: transpileOnly, how can i implement this to doczrc.js
If you want to transpile Typescript on our project just pass a config on your doczrc.js
:
// doczrc.js
export default {
typescript: true
}
So, if you want some custom config do something like we did on docz-plugin-babel6 @mbrn https://github.com/pedronauck/docz/blob/master/packages/docz-plugin-babel6/src/index.ts
My project created by create-react-app-typescript. I tried to import
.tsx
component but got 'This relative module was not found' message. Is the usage incorrect or is it not yet supported?