<?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>Various problems when including React dependencies</title>
  <link rel="self" href="https://liferay.dev/fr/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120945880" />
  <subtitle>Various problems when including React dependencies</subtitle>
  <id>https://liferay.dev/fr/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120945880</id>
  <updated>2026-04-27T11:09:42Z</updated>
  <dc:date>2026-04-27T11:09:42Z</dc:date>
  <entry>
    <title>RE: Various problems when including React dependencies</title>
    <link rel="alternate" href="https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121027063" />
    <author>
      <name>Deepak Poyilil</name>
    </author>
    <id>https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121027063</id>
    <updated>2021-08-08T15:53:14Z</updated>
    <published>2021-08-08T15:47:03Z</published>
    <summary type="html">&lt;p&gt;Hi Andre, I understand your question completely since i have gone
  through all these issues while working with React portlet in  Liferay
  7.2. Liferay using liferay-js-generator and its own bundler called
  liferay-npm-bundler, because of this bundler you will face build,
  deployment and loading issue when working with react portlet. when i
  fixed dependeny issues then, faced deployment issue, since the build
  process for liferay-npm-bundler will take long time when you use more
  dependencies. If you move this into a common module probably you can
  fix this deployment issue but again another issue will come that is
  initial load issue. The portlet may not load on first time and will
  never load on a slow network. The solution i have used here is get rid
  of liferay npm bundler and used webpack instead. But creating react
  portlet with webpack build need many customization on the project
  structure and configuration. But its working better than the one
  generated with liferay-npm-bundler. I have documented my understanding
  in the below blog, it may help you to get a better picture,&lt;/p&gt;
&lt;p&gt;
  &lt;a
    href="http://liferayconsultant.blogspot.com/2021/02/react-development-in-liferay-overview.html"&gt;React
    develoment in liferay&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
  &lt;a
    href="http://liferayconsultant.blogspot.com/2021/02/react-development-in-liferay-overview.html"&gt;Liferay
    react with webpack&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Moroever from the Liferay Devcon 2021 &lt;a
  href="https://vimeo.com/showcase/8258302/video/525553795"&gt;link&lt;/a&gt;,
  what i understood from Liferay front end engineer is that, they have
  stopped the liferay-npm-bundler v3.0 project development and webpack
  federation will replace the existing liferay bundler v2, ( some one
  correct me if i am wrong on this).&lt;/p&gt;
&lt;p&gt;so my question to all front end liferay expert here is, what is your
  front end recomendation  to develop an application in Liferay 7.3,
  Liferay MVC with JSP, React portlet with webpack, React with Liferay
  npm bundler, clay or something else ?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>Deepak Poyilil</dc:creator>
    <dc:date>2021-08-08T15:47:03Z</dc:date>
  </entry>
  <entry>
    <title>RE: Various problems when including React dependencies</title>
    <link rel="alternate" href="https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120956579" />
    <author>
      <name>Sascha Hofrichter</name>
    </author>
    <id>https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120956579</id>
    <updated>2021-07-17T01:19:11Z</updated>
    <published>2021-07-16T19:07:15Z</published>
    <summary type="html">&lt;p&gt;Hi André,&lt;br /&gt;
  &lt;br /&gt; First of all. The documentation of the 'generator-liferay-js'
  and other tools is .... ehm ... confusing at so many places ( sorry
  Liferay guys :-P ). &lt;br /&gt; And I don't know why the Liferay guys build
  up so many self-written tools. That makes the development very
  hard.&lt;br /&gt; Anyway, there are so many combiniations of loaders
  and configurations. I have no idea which possibilities are right for
  you.&lt;br /&gt; To understand how the liferay-npm-bundler works and what
  options do you have, look at this:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;a href="https://github.com/liferay/liferay-frontend-projects/blob/master/maintenance/projects/js-toolkit/docs/How-to-use-liferay-npm-bundler.md"&gt;https://github.com/liferay/liferay-frontend-projects/blob/master/maintenance/projects/js-toolkit/docs/How-to-use-liferay-npm-bundler.md&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
    &lt;a href="https://github.com/liferay/liferay-frontend-projects/tree/master/maintenance/projects/js-toolkit/docs"&gt;https://github.com/liferay/liferay-frontend-projects/tree/master/maintenance/projects/js-toolkit/docs&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;
  &lt;br /&gt; I have tested a fresh generated React portlet with your given
  example code. &lt;u&gt;Without any adjustments on the .npmbundlerrc&lt;/u&gt;. And
  I have issues too.&lt;br /&gt; But, I get (in my browser) this message first:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-javascript"&gt;Uncaught SyntaxError: Unexpected token 'export'&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It caused by following generated code:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;//# sourceMappingURL=index.js.map
Liferay.Loader.define(&amp;quot;@amcharts-demo$amcharts/amcharts4@4.10.20/core&amp;quot;, ['module', 'exports', 'require'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    /**
     * This module houses all core/framework functionality and is required for
     * all charting components to work
     */
    /**
     * Elements: core
     */
    export { System, system } from &amp;quot;./.internal/core/System&amp;quot;;
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   ...
   ...
   ... 
  }
});&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  &lt;br /&gt; I think, that the liferay-npm-bundler doesn't build the JS
  correctly with the amchart library.&lt;br /&gt; I'm not sure but I seem to
  remember that the liferay-npm-bundler uses webpack 4.29.x in the
  background.&lt;br /&gt; And there is a kwon issue in webpack.&lt;br /&gt; Please
  look at this: &lt;a href="https://www.amcharts.com/docs/v4/getting-started/integrations/using-webpack/"&gt;https://www.amcharts.com/docs/v4/getting-started/integrations/using-webpack/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I haven't tested this yet.&lt;/p&gt;
&lt;p&gt;Maybe it helps you.&lt;/p&gt;</summary>
    <dc:creator>Sascha Hofrichter</dc:creator>
    <dc:date>2021-07-16T19:07:15Z</dc:date>
  </entry>
  <entry>
    <title>RE: RE: Various problems when including React dependencies</title>
    <link rel="alternate" href="https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120954802" />
    <author>
      <name>André Bräkling</name>
    </author>
    <id>https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120954802</id>
    <updated>2021-07-16T06:30:00Z</updated>
    <published>2021-07-16T06:29:59Z</published>
    <summary type="html">&lt;p&gt;Hi Sascha,&lt;/p&gt;
&lt;p&gt;thanks again for your help!&lt;/p&gt;
&lt;p&gt;Yes, the main file configuration is correct. As I said, our React
  modules work fine, only as soon as we want to add a component as a
  dependency, it becomes a gamble.&lt;/p&gt;
&lt;p&gt;I wasn't aware that npm-react-portlet was deprecated - thanks for
  pointing that out. We're migrating to 7.3 right now and haven't
  encountered any problems so far, but then that's probably just a
  matter of time. generator-liferay-js I've tested and I'm thrilled at
  first sight - unlike npm-react-portlet, using React in the frontend
  feels &amp;quot;right&amp;quot; with it, especially we don't have unnecessary
  overhead like the Java classes anymore. I really like it!&lt;/p&gt;
&lt;p&gt;But our problems still persist. I tried with amcharts again. I create
  the demo code which was offered by generator-liferay-js, and then just
  added the dependency for amcharts:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;{
	&amp;quot;name&amp;quot;: &amp;quot;amcharts-demo&amp;quot;,
	&amp;quot;version&amp;quot;: &amp;quot;1.0.0&amp;quot;,
	&amp;quot;description&amp;quot;: &amp;quot;Amcharts Demo&amp;quot;,
	&amp;quot;devDependencies&amp;quot;: {
		&amp;quot;liferay-npm-bundler&amp;quot;: &amp;quot;^2.26.0&amp;quot;,
		&amp;quot;liferay-npm-build-support&amp;quot;: &amp;quot;^2.26.0&amp;quot;,
		&amp;quot;copy-webpack-plugin&amp;quot;: &amp;quot;4.6.0&amp;quot;,
		&amp;quot;webpack&amp;quot;: &amp;quot;4.29.6&amp;quot;,
		&amp;quot;webpack-cli&amp;quot;: &amp;quot;3.3.0&amp;quot;,
		&amp;quot;webpack-dev-server&amp;quot;: &amp;quot;3.2.1&amp;quot;,
		&amp;quot;@babel/cli&amp;quot;: &amp;quot;^7.7.5&amp;quot;,
		&amp;quot;@babel/core&amp;quot;: &amp;quot;^7.7.5&amp;quot;,
		&amp;quot;@babel/preset-env&amp;quot;: &amp;quot;^7.7.6&amp;quot;,
		&amp;quot;@babel/preset-react&amp;quot;: &amp;quot;^7.7.4&amp;quot;,
		&amp;quot;@amcharts/amcharts4&amp;quot;: &amp;quot;^4.10.19&amp;quot;
	},
	&amp;quot;dependencies&amp;quot;: {
		&amp;quot;react&amp;quot;: &amp;quot;16.8.6&amp;quot;,
		&amp;quot;react-dom&amp;quot;: &amp;quot;16.8.6&amp;quot;
	},
	&amp;quot;scripts&amp;quot;: {
		&amp;quot;build&amp;quot;: &amp;quot;babel --source-maps -d build src &amp;amp;&amp;amp; npm run copy-assets &amp;amp;&amp;amp; liferay-npm-bundler&amp;quot;,
		&amp;quot;copy-assets&amp;quot;: &amp;quot;lnbs-copy-assets&amp;quot;,
		&amp;quot;translate&amp;quot;: &amp;quot;lnbs-translate&amp;quot;,
		&amp;quot;deploy&amp;quot;: &amp;quot;npm run build &amp;amp;&amp;amp; lnbs-deploy&amp;quot;,
		&amp;quot;start&amp;quot;: &amp;quot;lnbs-start&amp;quot;
	},
	&amp;quot;portlet&amp;quot;: {
		&amp;quot;com.liferay.portlet.display-category&amp;quot;: &amp;quot;JS Demo&amp;quot;,
		&amp;quot;com.liferay.portlet.header-portlet-css&amp;quot;: &amp;quot;/css/styles.css&amp;quot;,
		&amp;quot;com.liferay.portlet.instanceable&amp;quot;: true,
		&amp;quot;javax.portlet.name&amp;quot;: &amp;quot;amchartsdemo&amp;quot;,
		&amp;quot;javax.portlet.security-role-ref&amp;quot;: &amp;quot;power-user,user&amp;quot;,
		&amp;quot;javax.portlet.resource-bundle&amp;quot;: &amp;quot;content.Language&amp;quot;
	},
	&amp;quot;main&amp;quot;: &amp;quot;index.js&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then, I created a small component to use some amCharts demo code:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;import React, { useRef, useLayoutEffect } from 'react';
import logo from './logo.svg';
import './App.css';
import * as am4core from &amp;quot;amcharts/amcharts4/core&amp;quot;;
import * as am4charts from &amp;quot;@amcharts/amcharts4/charts&amp;quot;;
import am4themes_animated from &amp;quot;@amcharts/amcharts4/themes/animated&amp;quot;;

am4core.useTheme(am4themes_animated);

function Graph(props) {
  const chart = useRef(null);

  useLayoutEffect(() =&amp;gt; {
    let x = am4core.create(&amp;quot;chartdiv&amp;quot;, am4charts.XYChart);

    x.paddingRight = 20;

    let data = [];
    let visits = 10;

    for (let i = 1; i &amp;lt; 366; i++) {
      visits += Math.round((Math.random() &amp;lt; 0.5 ? 1 : -1) * Math.random() * 10);
      data.push({ date: new Date(2018, 0, i), name: &amp;quot;name&amp;quot; + i, value: visits });
    }

    x.data = data;

    let dateAxis = x.xAxes.push(new am4charts.DateAxis());
    dateAxis.renderer.grid.template.location = 0;

    let valueAxis = x.yAxes.push(new am4charts.ValueAxis());
    valueAxis.tooltip.disabled = true;
    valueAxis.renderer.minWidth = 35;

    let series = x.series.push(new am4charts.LineSeries());
    series.dataFields.dateX = &amp;quot;date&amp;quot;;
    series.dataFields.valueY = &amp;quot;value&amp;quot;;
    series.tooltipText = &amp;quot;{valueY.value}&amp;quot;;
    x.cursor = new am4charts.XYCursor();

    let scrollbarX = new am4charts.XYChartScrollbar();
    scrollbarX.series.push(series);
    x.scrollbarX = scrollbarX;

    chart.current = x;

    return () =&amp;gt; {
      x.dispose();
    };
  }, []);

  return (
    &amp;lt;div id=&amp;quot;chartdiv&amp;quot; style={{ width: &amp;quot;100%&amp;quot;, height: &amp;quot;500px&amp;quot; }}&amp;gt;&amp;lt;/div&amp;gt;
  );
}
export { Graph };&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(Based on https://www.amcharts.com/docs/v4/getting-started/integrations/using-react/)&lt;/p&gt;
&lt;p&gt;But I still receive this error message:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;Liferay AMD Loader: Unhandled failure: Error: The following problems where detected while resolving modules:
Missing version constraints for amcharts-demo$amcharts in package.json of amcharts-demo@1.0.0/amcharts4/core
Missing version constraints for @amcharts-demo$amcharts/amcharts4 in package.json of amcharts-demo@1.0.0/charts
Missing version constraints for @amcharts-demo$amcharts/amcharts4 in package.json of amcharts-demo@1.0.0/themes/animated
    at Loader._getResolutionError (loader.js:312)
    at loader.js:200 while resolving modules: [&amp;quot;amcharts-demo@1.0.0/index&amp;quot;]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, switching to generator-liferay-js seems to be a big step forward
  (thanks again!), but does not solve our dependency issues. I'll ask my
  collegues who tried the other components I mentioned - maybe they have
  more luck, after all, the error messages were also partly very different.&lt;/p&gt;</summary>
    <dc:creator>André Bräkling</dc:creator>
    <dc:date>2021-07-16T06:29:59Z</dc:date>
  </entry>
  <entry>
    <title>RE: Various problems when including React dependencies</title>
    <link rel="alternate" href="https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120950199" />
    <author>
      <name>Sascha Hofrichter</name>
    </author>
    <id>https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120950199</id>
    <updated>2021-07-15T15:02:05Z</updated>
    <published>2021-07-15T13:43:23Z</published>
    <summary type="html">&lt;p&gt;Hi André,&lt;br /&gt;
  &lt;br /&gt; OK. Sorry, I can't check this at the moment. Because these
  npm-react-portlets are not genereted by the Liferay IntelliJ Plugin if
  your Liferay version is 7.2+.&lt;br /&gt; In InteliJ I get this error:&lt;/p&gt;
&lt;p&gt;
  &lt;img alt="" src="/documents/14/0/intellij_screenshot_generate_npm_react_portlet.png/c4d2dc4e-1beb-48d6-ee9c-12bbb6edd310?t=1626355734984&amp;amp;imagePreview=1" /&gt;
  &lt;br /&gt; Look at this: &lt;a
  href="https://issues.liferay.com/browse/LPS-97950"&gt;https://issues.liferay.com/browse/LPS-97950&lt;/a&gt;&lt;br /&gt;
  I don't know if Liferay 7.1 DXP supports the React portlets made with
  'generator-liferay-js'. But if it does, I would take this way.&lt;br /&gt;
  Otherwise you have the next 'bigger' migrations if you update your
  Liferay from 7.1 to 7.2+.&lt;/p&gt;
&lt;p&gt;I don't know how the npm-react-portlet works but I in your screenshot
  the 'main' points to 'lib/index.es.js'.&lt;br /&gt; Is this the right file? &lt;br /&gt;
  &lt;br /&gt;  &lt;/p&gt;</summary>
    <dc:creator>Sascha Hofrichter</dc:creator>
    <dc:date>2021-07-15T13:43:23Z</dc:date>
  </entry>
  <entry>
    <title>RE: RE: Various problems when including React dependencies</title>
    <link rel="alternate" href="https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120949785" />
    <author>
      <name>André Bräkling</name>
    </author>
    <id>https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120949785</id>
    <updated>2021-07-15T11:28:41Z</updated>
    <published>2021-07-15T11:28:40Z</published>
    <summary type="html">&lt;p&gt;Hello Sascha,&lt;/p&gt;
&lt;p&gt;thanks for your reply!&lt;/p&gt;
&lt;p&gt;I'll give this a try and see if this will make a difference. But our
  problems occur not on building the modules, but on using them. Anyway,
  I'll try and will post my feedback later today! :-)&lt;/p&gt;
&lt;p&gt;We create our React Modules within IntelliJ by using the Liferay
  Module template npm-react-portlet.&lt;/p&gt;
&lt;p&gt;Our working package.json files look like this:&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;{
	&amp;quot;dependencies&amp;quot;: {
		&amp;quot;react&amp;quot;: &amp;quot;16.8.6&amp;quot;,
		&amp;quot;react-dom&amp;quot;: &amp;quot;16.8.6&amp;quot;
	},
	&amp;quot;devDependencies&amp;quot;: {
		&amp;quot;babel-cli&amp;quot;: &amp;quot;^6.26.0&amp;quot;,
		&amp;quot;babel-preset-env&amp;quot;: &amp;quot;^1.7.0&amp;quot;,
		&amp;quot;babel-preset-react&amp;quot;: &amp;quot;6.24.1&amp;quot;,
		&amp;quot;liferay-npm-bundler&amp;quot;: &amp;quot;2.19.4&amp;quot;,
		&amp;quot;liferay-npm-bundler-loader-json-loader&amp;quot;: &amp;quot;^2.20.0&amp;quot;
	},
	&amp;quot;main&amp;quot;: &amp;quot;lib/index.es.js&amp;quot;,
	&amp;quot;name&amp;quot;: &amp;quot;our-module-name&amp;quot;,
	&amp;quot;scripts&amp;quot;: {
		&amp;quot;build&amp;quot;: &amp;quot;babel --source-maps -d build/resources/main/META-INF/resources src/main/resources/META-INF/resources &amp;amp;&amp;amp; liferay-npm-bundler&amp;quot;
	},
	&amp;quot;version&amp;quot;: &amp;quot;1.0.0&amp;quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What we want to do is to load some additional react components from
  npm modules as dependencies, but just a few work, all other fail
  because of several error messages (version constraints, additional
  depenencies, etc.). Anyway, the amcharts, for example, are succesfully
  downloaded and appear within the node_modules folder, but no chance to
  import and use them.&lt;/p&gt;
&lt;p&gt;We tried as devDependency and as &amp;quot;normal&amp;quot; dependency as
  well. Yesterday we failed using react-markdown, so we now count five
  non-exotic react components we are not able to use within a Liferay
  module, but anywhere else where we use React.&lt;/p&gt;
&lt;p&gt;Creating a common library is a nice thing, but first we want to get
  the dependencies working in just one module before we start sharing
  them ;-)&lt;/p&gt;</summary>
    <dc:creator>André Bräkling</dc:creator>
    <dc:date>2021-07-15T11:28:40Z</dc:date>
  </entry>
  <entry>
    <title>RE: Various problems when including React dependencies</title>
    <link rel="alternate" href="https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120946292" />
    <author>
      <name>Sascha Hofrichter</name>
    </author>
    <id>https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120946292</id>
    <updated>2021-07-14T14:40:15Z</updated>
    <published>2021-07-14T09:41:38Z</published>
    <summary type="html">&lt;p&gt;Hey André,&lt;br /&gt; how do you create the React portlets?&lt;br /&gt; Do you
  use the 'generator-liferay-js' like this &lt;a
  href="https://help.liferay.com/hc/en-us/articles/360029147411-Installing-the-JS-Generator-and-Generating-a-Bundle"&gt;https://help.liferay.com/hc/en-us/articles/360029147411-Installing-the-JS-Generator-and-Generating-a-Bundle&lt;/a&gt;?&lt;br /&gt;
  I know, this document relates to the Liferay 7.2 DXP but it could help
  you to generate the React portlets.&lt;/p&gt;
&lt;p&gt;We use the React portlets in Liferay 7.4.1 CE and generate the
  portlets with this tool. By this reason, I don't know if this
  will help you.&lt;br /&gt; Note: if you want to use this, you must make
  adjustments in the .babelrc file to add some plugins. Otherwise you
  have some strange side effects with JS arrow functions etc. Add the
  plugins do you need like that in the .babelrc:&lt;/p&gt;
&lt;p&gt;&amp;quot;plugins&amp;quot;: [&lt;br /&gt;    
  &amp;quot;@babel/plugin-transform-arrow-functions&amp;quot;,&lt;br /&gt;    
  &amp;quot;@babel/plugin-proposal-class-properties&amp;quot;,&lt;br /&gt;   
   &amp;quot;syntax-async-functions&amp;quot;&lt;br /&gt; ]&lt;br /&gt; If you use the
  'generator-liferay-js'  it will generate a package.json for you. The
  package.json contains a 'build' script where babel and other liferay
  build tasks are called. These build script will copy (into a 'build'
  folder inside your portlet directory) all your NPM modules which are
  listed in your 'dependencies' section of the package.json. After that,
  the 'liferay-npm-bundler' will create the deployable *.jar file. This
  *.jar file contains your NPM modules. &lt;/p&gt;
&lt;p&gt;Another Blog post might be interesting for you: &lt;a
  href="https://liferay.dev/blogs/-/blogs/how-to-use-shared-library-javascript-with-react-in-liferay"&gt;https://liferay.dev/blogs/-/blogs/how-to-use-shared-library-javascript-with-react-in-liferay&lt;/a&gt;&lt;br /&gt;
  This post describes how you create a 'shared' JS library which you can
  use in other ReactJS portlets.&lt;/p&gt;
&lt;p&gt;
  &lt;br /&gt; I hope this will help you.&lt;/p&gt;</summary>
    <dc:creator>Sascha Hofrichter</dc:creator>
    <dc:date>2021-07-14T09:41:38Z</dc:date>
  </entry>
  <entry>
    <title>Various problems when including React dependencies</title>
    <link rel="alternate" href="https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120945879" />
    <author>
      <name>André Bräkling</name>
    </author>
    <id>https://liferay.dev/fr/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120945879</id>
    <updated>2021-08-16T20:22:01Z</updated>
    <published>2021-07-14T08:34:45Z</published>
    <summary type="html">&lt;p&gt;Hello everybody,&lt;/p&gt;
&lt;p&gt;for some time now we have been migrating our existing portlets to
  React components to create a modern and flexible frontend.&lt;/p&gt;
&lt;p&gt;Sadly, we face various problems when we try to include predefined
  components as dependecies, so that a meaningful use of React is hardly
  possible. At first we assumed that we might have chosen too exotic
  components, or that we were doing the inclusion incorrectly, but the
  problems are occurring with more and more proven components, and in
  environments outside of Liferay (even in simple sandboxes like
  codesandbox.ai) everything works fine.&lt;/p&gt;
&lt;p&gt;Generally, the problems mostly relate to further dependencies or to
  versions or version conflicts. However, since the error messages are
  very different, we have no real point of attack here. &lt;/p&gt;
&lt;p&gt;Lastly, we tried to &lt;a
    href="https://help.liferay.com/hc/en-us/articles/360017890812-Node-Gradle-Plugin"&gt;update
    the embedded Node/NPM version&lt;/a&gt;, but without finding any effect
  here. We are using Liferay 7.1 (DXP/Enterprise).&lt;/p&gt;
&lt;p&gt;Here a list of examples:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;react-sortablejs, Version 6.0.0., Error: The provided
    configuration is not Directed Acyclic Graph. (&lt;a
      href="https://liferay.dev/en/ask/questions/development/react-portlet-the-provided-configuration-is-not-directed-acyclic-graph--1?sort=active"&gt;Post
      about similar issue, but no solution approach for us&lt;/a&gt;) &lt;/li&gt;
  &lt;li&gt;reactstrap, Version 8.9.0, Error: load timeout reactstrap modal
    $has@1.0.3 and $call-bind&lt;/li&gt;
  &lt;li&gt;react-checkbox-tree, Error: Uncaught ReferenceError: Buffer is not
    defined. We can include &amp;quot;buffer&amp;quot; as well, but next the
    crypto package is required, &lt;a
      href="https://www.npmjs.com/package/crypto"&gt;but this should be a
      &amp;quot;built-in&amp;quot; plugin now&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;amcharts, Version 4.10.19, Error: Missing version constraints. (&lt;a
      href="https://liferay.dev/en/ask/questions/development/using-amcharts-in-a-react-module"&gt;I
      already created a thread about this, no response until now.&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;I can't imagine we're the only ones using React and want to
  incorporate existing components/modules. Either we are doing something
  fundamentally wrong here or have a thinking error, or these problems
  should have been noticed by one or the other of you already.&lt;/p&gt;
&lt;p&gt;Does anyone have a starting point for us? Maybe links that go beyond
  the basic Liferay tutorials &amp;amp; docs, which are unfortunately once
  again not very helpful here, and address such things? Best practices?&lt;/p&gt;
&lt;p&gt;Right now it seems easier for us to build the frontend as a
  standalone React application and run Liferay behind it as a headless
  CMS, but that can't be in the spirit of the inventor, can it?&lt;/p&gt;
&lt;p&gt;If any details (package.json, stacktraces, ...) help you further,
  please let me know (if necessary also in relation to which
  component/error message, as we are dealing with different modules in
  our system), I'll submit anything that could help further.&lt;/p&gt;
&lt;p&gt;Thanks in advance!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>André Bräkling</dc:creator>
    <dc:date>2021-07-14T08:34:45Z</dc:date>
  </entry>
</feed>
