-
Notifications
You must be signed in to change notification settings - Fork 9
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
Consuming projects can't find JSX.IntrinsicElements
after v2.1.2
#38
Comments
Interesting. When I tested with Perhaps I'm missing something? |
When I was creating a sandbox for the other issue (example) I noticed that upgrading to v2.1.2 caused JSX tags to have the error Interestingly, I don't get this problem with my application. So the difference may be related to the specific setup the code sandbox uses. But I want to investigate since this looks like a regression against a previously-working setup. |
I agree. Especially since CodeSandbox is a very common usecase. |
Looks like the difference between codesandbox and the CFA template & my own project is the latter have a "jsxFactory": "forgo.createElement",
"jsxFragmentFactory": "forgo.Fragment", while the codesandbox template uses "jsxFactory": "createElement",
"jsxFragmentFactory": "Fragment", So not specific to the codesandbox environment, just an app config difference. If I reconfigure the codesandbox to use the former config style, the error goes away. I'll try to fix the codesandbox-style config. I think the |
...which is probably exactly what the |
You're right, sorry I should have remembered this. IIRC it was a lot of trial and error to get it working, but I had completely forgotten why and how it was done. |
I spent some tore time trying to piece together a solution today. Definitely trial and error. TS doesn't like importing and re-exporting a I'll probably wind up switching back to an actual import and getting the build to include a module that can be imported, just to get the old way of handling this to work when run through esbuild. |
I've got the types issue sorted out, but I had to adjust the build pipeline and broke the source map in the process. The (I also tried getting So I walked the issue back: prior to enabling the minified build, a normal The solution looks like running But that means we have to generate the source map from I've got a WIP branch pushed, and once I get the source map fixed I'll clean everything up and squash it down to one nice, tidy commit. |
It looks like esbuild is supposed to identify and drop type-only imports. But it doesn't recognize that this is a type-only import because without |
# Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch and 'origin/fix-jsx-types' have diverged, # and have 6 and 7 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch and 'origin/fix-jsx-types' have diverged, # and have 6 and 7 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch and 'origin/fix-jsx-types' have diverged, # and have 6 and 7 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json #
# Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch and 'origin/fix-jsx-types' have diverged, # and have 6 and 7 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch and 'origin/fix-jsx-types' have diverged, # and have 6 and 7 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch and 'origin/fix-jsx-types' have diverged, # and have 6 and 7 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch is up to date with 'origin/fix-jsx-types'. # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json #
# Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch and 'origin/fix-jsx-types' have diverged, # and have 6 and 7 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch and 'origin/fix-jsx-types' have diverged, # and have 6 and 7 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch and 'origin/fix-jsx-types' have diverged, # and have 6 and 7 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch is up to date with 'origin/fix-jsx-types'. # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json # # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Date: Wed Jan 26 19:11:24 2022 -0500 # # On branch fix-jsx-types # Your branch is up to date with 'origin/fix-jsx-types'. # # Changes to be committed: # modified: package.json # modified: src/index.ts # modified: src/jsxTypes.ts # modified: tsconfig.json #
Okay, all set - PR is up. The secret sauce is that esbuild also had to be put into bundle mode to detect that the import was types-only, and now also needs the I also simplified the way the bundle + types are declared in Please give this a whirl and let me know if you find any problems. Or don't -- I may throw TypeScript into a volcano if this somehow still isn't fixed 🙂 |
Haha. I'll try this today, and publish a new version. Thanks. |
…ory (#41) Co-authored-by: spiffytech <git@spiffy.tech> Co-authored-by: Jeswin <jeswinpk@agilehead.com>
@spiffytech Tested on CodeSandbox. https://codesandbox.io/s/forgo-todos-typescript-9v0iy It works! 🥳 |
LGTM! |
In v2.1.2 consuming projects can't find the
JSX.IntrinsicElements
interface.forgo
is exportingJSX
, butforgo.createElement
isn't detecting that.This was introduced by the merge of 812177f (my commit, my bad). I'm not sure why this didn't turn up when I tested of that commit.
I'll have a PR up once I identify a fix.
Prior to v2.1.2,
forgo
declared namespacecreateElement
with namespaceJSX
inside of it. 812177f switched the full module import (import "./jsxTypes"
) to a types import (import type "./jsxTypes"
) to fix an esbuild issue, and that means the old way of declaring thecreateElement
namespace doesn't work.I'm trying to determine a new way to do that, and also why that's necessary in the first place. I can't find any documentation indicating TS JSX needs a
createElement
namespace. So presumably there's another way to go about the problem.The text was updated successfully, but these errors were encountered: