Skip to content
This repository has been archived by the owner on Sep 23, 2023. It is now read-only.

[Question] How to load external CSS from a node_moodules package #241

Open
arthurhamon opened this issue Aug 17, 2021 · 1 comment
Open
Labels
Bug Something isn't working

Comments

@arthurhamon
Copy link

arthurhamon commented Aug 17, 2021

Hi and thank you for the help.

I have installed an external package, for example @name/my-package.

How can I load the css from this package using external-loader ?

I've tried to do it like this but its not working.

"plugins": [
      {
        "name": "external-loader",
        "options": {
          "paths": [
            "~@name/my-package/style.css"
          ]
        }
      }
    ]
@arthurhamon arthurhamon added the Bug Something isn't working label Aug 17, 2021
@vijay122
Copy link

vijay122 commented Feb 6, 2022

If i understand your question properly,
You should be able to include css files by directly importing them in your direflow components.
Filename : direflow-components/index.js

import "@name/my-package/style.css";

if you want to add additional loaders for the css file type, add webpack config for direflow,
Filename : direflow-webpack.js

                      module.exports = (config, env) => ({
                      ...webpackConfig(config, env),
                      module: {
                        rules: [
                          {
                            test: /\.(sa|sc|c)ss$/,
                            loader: ["style-loader", "css-loader", "sass-loader"],
                          },
                        ],
                      },
                      // Add your own webpack config here (optional)
                    });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants