<?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>OSGI NPM Bundler portlet: CSS not loaded properly</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=117292061" />
  <subtitle>OSGI NPM Bundler portlet: CSS not loaded properly</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=117292061</id>
  <updated>2026-04-04T21:26:06Z</updated>
  <dc:date>2026-04-04T21:26:06Z</dc:date>
  <entry>
    <title>RE: OSGI NPM Bundler portlet: CSS not loaded properly</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119625313" />
    <author>
      <name>Andrea Daza</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119625313</id>
    <updated>2020-07-21T17:37:16Z</updated>
    <published>2020-07-21T17:37:16Z</published>
    <summary type="html">Hello Nils!,I&amp;#39;m actually have the same problem. Did you find the solution to fix it?, do you can help me?&lt;br /&gt;Thanks in advance !</summary>
    <dc:creator>Andrea Daza</dc:creator>
    <dc:date>2020-07-21T17:37:16Z</dc:date>
  </entry>
  <entry>
    <title>RE: OSGI NPM Bundler portlet: CSS not loaded properly</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117301999" />
    <author>
      <name>Nils Wilmet</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117301999</id>
    <updated>2019-09-27T07:57:03Z</updated>
    <published>2019-09-27T07:57:03Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi Ivan,&lt;br&gt;Thanks for your reply. I did tried the loaders in your Gthub repository, and I added&amp;nbsp;&lt;br&gt;&lt;pre&gt;&lt;code&gt;"liferay-npm-bundler":"2.13.2",
"liferay-npm-bundler-loader-style-loader":"2.13.2",&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;To my package.json. I also added the lines in your reply to my &lt;strong&gt;.npmbundlerrc&lt;/strong&gt;, but all I got is a &lt;pre&gt;&lt;code&gt;"Load timeout for modules"&lt;/code&gt;&lt;/pre&gt; in my Javascript console, and nothing appears. &lt;br&gt;I noticed that bad imports caused this error, so when i try to import CSS like &lt;pre&gt;&lt;code&gt;import './index.css'&lt;/code&gt;&lt;/pre&gt;&amp;nbsp;in my React components (with the .npmbundlerrc rule and the style-loader), it triggers that error.&lt;br&gt;&lt;br&gt;Is there a way to fix it ? Maybe my CSS files are not in the correct directory, or I am missing something ?&lt;br&gt;Thanks again !&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Nils Wilmet</dc:creator>
    <dc:date>2019-09-27T07:57:03Z</dc:date>
  </entry>
  <entry>
    <title>RE: OSGI NPM Bundler portlet: CSS not loaded properly</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117296103" />
    <author>
      <name>Iván Zaera Avellón</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117296103</id>
    <updated>2019-09-27T07:17:33Z</updated>
    <published>2019-09-27T07:17:33Z</published>
    <summary type="html">Please see this &lt;a href="https://github.com/liferay/liferay-js-toolkit/issues/303"&gt;issue&lt;/a&gt; for more information on the feature that allows you to use import/require css.&lt;br /&gt;There used to be a sample application in &lt;a href="https://github.com/izaera/liferay-js-toolkit-showcase/commits/loaders"&gt;this repo&lt;/a&gt; but now it&amp;#39;s broken :-(. I will fix it ASAP.&lt;br /&gt;Basically all you need to do is using a bundler &amp;gt;= 2.13.2 and configuring a rule like this in your .npmbundlerrc:&lt;br /&gt;&lt;br /&gt;&amp;#34;rules&amp;#34;: [&lt;br /&gt;    {&lt;br /&gt;      &amp;#34;test&amp;#34;: &amp;#34;\\.css$&amp;#34;,&lt;br /&gt;      &amp;#34;use&amp;#34;: [&amp;#34;style-loader&amp;#34;]&lt;br /&gt;    }&lt;br /&gt;]</summary>
    <dc:creator>Iván Zaera Avellón</dc:creator>
    <dc:date>2019-09-27T07:17:33Z</dc:date>
  </entry>
  <entry>
    <title>OSGI NPM Bundler portlet: CSS not loaded properly</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117292060" />
    <author>
      <name>Nils Wilmet</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117292060</id>
    <updated>2019-09-26T13:25:03Z</updated>
    <published>2019-09-26T13:25:03Z</published>
    <summary type="html">Hi !&lt;br /&gt;I&amp;#39;m currently working on a React portlet with a CSS import in the component property &amp;#34;com.liferay.portlet.header-portlet-css&amp;#34;. It went well, and if i&amp;#39;m writing CSS references in that CSS files (ie @import &amp;#34;./filterBox.css&amp;#34;) the portal loads it perfectly in &amp;#34;/o/[PortletContextName]/css/filterBox.css&amp;#34;.&lt;br /&gt;But when I&amp;#39;m trying that on a production environment, it looks for the file in &amp;#34;/&amp;#34;, which results in a &amp;#34;Refused to apply style from &amp;#39;&amp;lt;URL&amp;gt;&amp;#39; because its MIME type (&amp;#39;text/html&amp;#39;) is not a supported stylesheet MIME type [...]&amp;#34;&lt;br /&gt;Even if the file exists in the production environment at /o/[PortletContextName]/css it don&amp;#39;t want to load it from that location.&lt;br /&gt;Is it some sort of configuration that I could have written that override that process of fetching CSS files ? &lt;br /&gt;Thanks in advance !</summary>
    <dc:creator>Nils Wilmet</dc:creator>
    <dc:date>2019-09-26T13:25:03Z</dc:date>
  </entry>
</feed>
