Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant load Component with *.css import #629

Closed
meetromb opened this issue Feb 13, 2019 · 3 comments
Closed

Cant load Component with *.css import #629

meetromb opened this issue Feb 13, 2019 · 3 comments

Comments

@meetromb
Copy link

Bug Report

docz dev throwing error, when css styles imported directly into component js file:

Failed to compile.

./src/components/Button/index.css 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
> .button-v1 {
|     border-radius: 20px;
|     font-family: 'roboto_medium';

code
code2

@hastebrot
Copy link
Contributor

I guess you need to modify the webpack configuration.

In doczrc.js:

  modifyBundlerConfig: bundlerConfig => {
    const rules = [
      {
        test: /\.css$/,
        loader: "style-loader!css-loader"
      }
    ];
    bundlerConfig.module.rules.push(...rules);
    return bundlerConfig;
  }

In package.json:

  "devDependencies": {
    "css-loader": "^2.1.0",
    "style-loader": "^0.23.1"
  }

Documentation: https://www.docz.site/documentation/project-configuration#build-pipeline

@meetromb
Copy link
Author

I guess you need to modify the webpack configuration.

In doczrc.js:

  modifyBundlerConfig: bundlerConfig => {
    const rules = [
      {
        test: /\.css$/,
        loader: "style-loader!css-loader"
      }
    ];
    bundlerConfig.module.rules.push(...rules);
    return bundlerConfig;
  }

In package.json:

  "devDependencies": {
    "css-loader": "^2.1.0",
    "style-loader": "^0.23.1"
  }

Documentation: https://www.docz.site/documentation/project-configuration#build-pipeline

Yep, its working. Thank you)

@raikusy
Copy link

raikusy commented May 27, 2019

I tried the above sollution, it didn't work. I am using docz with a rollup config. Check this branch docz-css.
I am also getting the same error with docz-plugin-css
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants