RE: JS Module with Blade : can't use require()

Nils Wilmet, modified 6 Years ago. New Member Posts: 20 Join Date: 4/24/19 Recent Posts
Hi,

I'v created a portlet with Eclipse Liferay IDE, npm-react-portlet. Everything works fine except for to main issues :
  • I can't user the method "require()" for style or image
  • I can't use "import" on css or images
I think it's because of that that a lot of npm plugins I want to use ends up not working or working partially.

Both of above methods (require and imports css/images) are not working and results in the same error : no portlet and this error in dev console
Load timeout for modules: metal-dom/src/all/dom,metal-uri/src/Uri,clay-tooltip/src/ClayTooltip,agiir-petitesannonces@1.0.0

I've already installed and using the preset es2016 for Babel. Is this an issue with Babel ? Do I need to install something else ?

Thanks a lot
thumbnail
Ivan Zaera, modified 6 Years ago. Regular Member Posts: 119 Join Date: 10/1/13 Recent Posts
Hi Nils:

Unfortunately we don't support import for static resources yet. You can track the progress of its implementation here: https://github.com/liferay/liferay-npm-build-tools/issues/303

Alternatively, if you want to contribute that support to make arrive faster, I can guide you on how it could be done :-).

Cheers,
Ivan
Amos Fong, modified 6 Years ago. New Member Posts: 20 Join Date: 4/24/19 Recent Posts
Hi Ivan,

Alright thanks for the information.
​​​​​​​
I don't see myself as a very good developer to contribute on that feature but I'll wait for this to be available emoticon