<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Liferay 7.1 React Portlet - Component Import Error</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111441526" />
  <subtitle>Liferay 7.1 React Portlet - Component Import Error</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111441526</id>
  <updated>2026-04-04T09:45:29Z</updated>
  <dc:date>2026-04-04T09:45:29Z</dc:date>
  <entry>
    <title>RE: Liferay 7.1 React Portlet - Component Import Error</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113566886" />
    <author>
      <name>Bhoomi Vaddoriya</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113566886</id>
    <updated>2019-05-08T08:59:48Z</updated>
    <published>2019-05-08T08:59:48Z</published>
    <summary type="html">Thank you for your response.&lt;br /&gt;&lt;br /&gt;I have already tried to migrate bundler &amp;#39;1.x&amp;#39; to &amp;#39;2.x&amp;#39;, but it throws an error &amp;#34;Uncaught (in promise) TypeError: bootstrapRequire.default is not a function&amp;#34; in browser console.</summary>
    <dc:creator>Bhoomi Vaddoriya</dc:creator>
    <dc:date>2019-05-08T08:59:48Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 React Portlet - Component Import Error</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113564695" />
    <author>
      <name>Iván Zaera Avellón</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113564695</id>
    <updated>2019-05-08T07:29:21Z</updated>
    <published>2019-05-08T07:29:21Z</published>
    <summary type="html">Hi:&lt;br /&gt;&lt;br /&gt;First of all, you must migrate to bundler 2.x, because peer dependencies are not correctly supported in bundler 1.x.&lt;br /&gt;&lt;br /&gt;Follow the guidelines at &lt;a href="https://github.com/liferay/liferay-npm-build-tools/wiki/Migrating-bundler-from-1.x-to-2.x"&gt;https://github.com/liferay/liferay-npm-build-tools/wiki/Migrating-bundler-from-1.x-to-2.x&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also, there&amp;#39;s more interesting information about the bundler in that same wiki &lt;a href="https://github.com/liferay/liferay-npm-build-tools/wiki"&gt;https://github.com/liferay/liferay-npm-build-tools/wiki&lt;/a&gt; that may help you understand the model and how everything works under the hood.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Ivan&lt;a href="https://github.com/liferay/liferay-npm-build-tools/wiki"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;</summary>
    <dc:creator>Iván Zaera Avellón</dc:creator>
    <dc:date>2019-05-08T07:29:21Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 React Portlet - Component Import Error</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113551665" />
    <author>
      <name>Bhoomi Vaddoriya</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113551665</id>
    <updated>2019-05-07T08:45:15Z</updated>
    <published>2019-05-07T08:45:15Z</published>
    <summary type="html">Hi everyone, I have got the same problem.&lt;br /&gt;&lt;br /&gt;I have created an npm-react portlet. &lt;br /&gt;when I install the react-redux@7.0.3 plugin in my portlet it works fine. But when I import that plugin&amp;#39;s component that gives an error like &amp;#34;Missing version constraints for react-dom in package.json of react-redux@7.0.3&amp;#34;&lt;br /&gt;&lt;br /&gt;Does anyone have a solution about?</summary>
    <dc:creator>Bhoomi Vaddoriya</dc:creator>
    <dc:date>2019-05-07T08:45:15Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 React Portlet - Component Import Error</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111516988" />
    <author>
      <name>Iván Zaera Avellón</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111516988</id>
    <updated>2018-11-12T08:28:47Z</updated>
    <published>2018-11-12T08:28:47Z</published>
    <summary type="html">&lt;p&gt;&amp;gt; So does that mean we should never load react dependencies from theme?&lt;/p&gt;
&lt;p&gt;No. You  can still use the theme approach, but it is better to use
  bundler as it is the preferred tool for this kind of things.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&amp;gt; If i have multiple portlets (example: 30) so do i need to load
  react dependencies for each and every portlet individually? instead of
  loading only once from the theme?&lt;/p&gt;
&lt;p&gt;No. You have to create a &amp;quot;shared bundle&amp;quot; containing react
  and then point your portlets to that bundle to obtain react. You can
  see a similar example using Angular (unfortunately based on blade, but
  you get the idea I hope) here -&amp;gt; https://github.com/izaera/liferay-npm-bundler-2-example/tree/master/modules&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Pay special attention to
  https://github.com/izaera/liferay-npm-bundler-2-example/blob/master/modules/npm-angular5-portlet-say-hello/.npmbundlerrc#L7-L28
  which is the place where the import of angular from the shared bundle
  takes place.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&amp;gt;what kind of portlet am i supposed to go for now &amp;quot;react
  based portlet&amp;quot; or &amp;quot;javascript based porlet&amp;quot;? &lt;/p&gt;
&lt;p&gt;React.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Ivan&lt;/p&gt;</summary>
    <dc:creator>Iván Zaera Avellón</dc:creator>
    <dc:date>2018-11-12T08:28:47Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 React Portlet - Component Import Error</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111453497" />
    <author>
      <name>rayvanth challa</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111453497</id>
    <updated>2018-11-05T16:38:01Z</updated>
    <published>2018-11-05T16:38:01Z</published>
    <summary type="html">&lt;p&gt;Thanks Ivan for the quick response. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;So does that mean we should never load react dependencies from theme? &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;If i have multiple portlets (example: 30) so do i need to load react
  dependencies for each and every portlet individually? instead of
  loading only once from the theme?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;what kind of portlet am i supposed to go for now &amp;quot;react based
  portlet&amp;quot; or &amp;quot;javascript based porlet&amp;quot;? &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;i am not sure mine is the right approach. please advice the correct
  route to get this resolved.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Ray&lt;/p&gt;</summary>
    <dc:creator>rayvanth challa</dc:creator>
    <dc:date>2018-11-05T16:38:01Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 React Portlet - Component Import Error</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111443138" />
    <author>
      <name>Iván Zaera Avellón</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111443138</id>
    <updated>2018-11-05T09:04:34Z</updated>
    <published>2018-11-05T09:04:34Z</published>
    <summary type="html">&lt;p&gt;Hi Rayvanth:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;As you are on Liferay 7.1, please consider using the
  liferay-npm-bundler tools instead of adding react to a theme. That is
  the preferred way to deal with Javascript in the newest Liferay versions.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;You can get more information here -&amp;gt; &lt;a href="https://github.com/liferay/liferay-npm-build-tools/wiki"&gt;https://github.com/liferay/liferay-npm-build-tools/wiki&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;And pay special attention to this section on how to create a portlet
  from scratch -&amp;gt; &lt;a href="https://github.com/liferay/liferay-npm-build-tools/wiki/How-to-use-generator-liferay-bundle"&gt;https://github.com/liferay/liferay-npm-build-tools/wiki/How-to-use-generator-liferay-bundle&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Ivan&lt;/p&gt;</summary>
    <dc:creator>Iván Zaera Avellón</dc:creator>
    <dc:date>2018-11-05T09:04:34Z</dc:date>
  </entry>
  <entry>
    <title>Liferay 7.1 React Portlet - Component Import Error</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111441525" />
    <author>
      <name>rayvanth challa</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111441525</id>
    <updated>2018-11-04T21:37:02Z</updated>
    <published>2018-11-04T21:37:02Z</published>
    <summary type="html">&lt;p&gt;Hi Everyone,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I have to create multiple react portlets in my project, so instead of
  loading react dependencies for each and every portlet i had loaded
  those dependencies through my theme as below&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;script type=&amp;quot;application/javascript&amp;quot;
  src=&amp;quot;https://unpkg.com/react@16.0.0/umd/react.production.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;script type=&amp;quot;application/javascript&amp;quot;
  src=&amp;quot;https://unpkg.com/react-dom@16.0.0/umd/react-dom.production.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;script type=&amp;quot;application/javascript&amp;quot;
  src=&amp;quot;https://unpkg.com/babel-standalone@6.26.0/babel.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;script type=&amp;quot;text/javascript&amp;quot;
  src=&amp;quot;https://cdnjs.cloudflare.com/ajax/libs/react-transition-group/2.2.1/react-transition-group.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;script type=&amp;quot;text/javascript&amp;quot;
  src=&amp;quot;https://cdnjs.cloudflare.com/ajax/libs/reactstrap/6.0.1/reactstrap.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;script
  src=&amp;quot;https://npmcdn.com/react-bootstrap-table/dist/react-bootstrap-table.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;link rel=&amp;quot;stylesheet&amp;quot;
  href=&amp;quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;https://cdnjs.cloudflare.com/ajax/libs/react-bootstrap-table/4.3.1/react-bootstrap-table-all.min.css&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&amp;lt;script type=&amp;quot;text/babel&amp;quot;&amp;gt;&lt;br /&gt; const {&lt;br /&gt;  
  Modal, &lt;br /&gt;   ModalHeader, &lt;br /&gt;   ModalBody, &lt;br /&gt;  
  ModalFooter,&lt;br /&gt;   Table,&lt;br /&gt;   Collapse,&lt;br /&gt;   CardBody, &lt;br /&gt;
    Card&lt;br /&gt; } = Reactstrap;&lt;br /&gt; &amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Now i had created a liferay module project with template
  as mvc-portlet and designed it as needed in jobboard.js file and
  deployed the application, now it is up and running with default react
  component loaded from jobboard.js file.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;But if create multiple components in multiple js files and if i try
  to import those components into the main js file then i am facing
  issue on the browser console with &amp;quot;require is undefined.&amp;quot;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Can i know what i have been missing while import?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I tried to add the below js file in my theme and tried to fix it but
  that didn't help&lt;/p&gt;
&lt;p&gt;&amp;lt;script src=&amp;quot;https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This is how &amp;quot;import ManageProfile from './manageProfile';&amp;quot; 
  i am importing one component into another.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Attached errors screen shot and module screenshot for reference. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Any help on this will be greatly appreciated.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Ray&lt;/p&gt;</summary>
    <dc:creator>rayvanth challa</dc:creator>
    <dc:date>2018-11-04T21:37:02Z</dc:date>
  </entry>
</feed>
