-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Next.js babel preset #72
Comments
Hi @retyui, could you create 2 separate issues for this instead? It looks like the JS code that our babel fbt plugin is analyzing was missing the Could you try to log the entire JS code to ensure that it's present before you start the babel fbt transform? We normally support that kind of ES6 import. |
@kayhadrin
babel/packages/babel-plugin-transform-typescript/src/index.js#102:106 isImportTypeOnly({
binding,
programPath: path,
jsxPragma: fileJsxPragma || jsxPragma,
})
stmt.remove(); |
I also create demo https://github.com/retyui/fbt-issues-72 |
Here's a diff I made from your repo at commit: retyui/fbt-issues-72@d23bea120e9368a22612a9064bfdf8e894c8bfdd:
I then ran the normal typescript transform with this command:
From this, I can see that the typescript transform is unable to detect that the Here's the result if I add some fbt() calls in the TSX code and generate the output (after re-enabling the fbt babel transforms):
PS: I think you have the babel transforms order in the wrong order in your original So this is more of an issue with the Typescript Babel transform and I'll leave it at that for now. |
@kathykam |
I suspect there's an unfortunate Babel transform ordering requirement here. Possibly related to our TODO: #40 @retyui, have you tried running the Typescript transform strictly AFTER the FBT transform? If (A) isn't true, this might solve your problems. |
Here is an article about Typescript + fbt where I describe problems that i faced and how to fix them |
@retyui I followed your guideline and its work well <3. But recently, after I have upgraded Next.Js from Maybe it has been removed by webpack as the unused code. |
1) Integration with Next.js (TypeScript)
I don't know how can I fix the next problem:
fbt is not bound. Did you forget to require('fbt')
Did It mean that webpack bundle remove unused import before babel transpilation?
2) Empty
childParentMappings:{}
And
node_modules/babel-plugin-fbt/bin/collectFBT.js
couldn't collect any phrases from codeDEMO Next.js App
The text was updated successfully, but these errors were encountered: