Differences between react mode and aliases + @tangible/window #2
Replies: 3 comments 6 replies
-
Hi @nicolas-jaussaud, thanks for the question. You're right that The The new solution is to use Internally, React mode From your description, it sounds like this is not being applied to the ..Oh, maybe you're importing the compiled/built library files of So I would say this is a bug in the React mode (Ah, cool - I can "Create issue from discussion" in the GitHub sidebar menu. Issue #3 ) |
Beta Was this translation helpful? Give feedback.
-
Whew, it took a couple hours of digging deep into the Rollup plugins, but I believe I solved it in commit d4a508d. The cause of the issue was that for The solution was to pass to the latter plugin a function that matches the module name as is (for It's been published as version |
Beta Was this translation helpful? Give feedback.
-
Thank you for the quick update! I tested again and while components imported from the lexical library are now using wp.element, it seems that there is an issue in the way it's imported Here is the error I got after updating and building a new file using the
In the built file, I have indeed multiple occurrences of something like: var react = wp.element.__require(); If I manually replace every occurence of |
Beta Was this translation helpful? Give feedback.
-
Hi @eliot-akira!
I have a question regarding the "React mode" argument of the roller (as long as it's not really an issue, I thought I could use this "discussions" feature for it)
I'm currently testing a library with the roller (lexical), with a setup similar to this one:
index.jsx being something like this:
It works well, but before I didn't use @tangible/window and had this config instead:
Which wasn't working and gave me the following error:
For what I understood, it was because a different version of React was imported by lexical, instead of wp-element
I'm not sure to understand why it works differently when using an alias with
@tangible/window
, and until now I was assuming that it was the same thing than usingreact: 'wp'
I was wondering what the differences between the two approaches are, and which method should be used in which cases
Beta Was this translation helpful? Give feedback.
All reactions