React-rails: How import css in prerender: true component

Created on 9 Jan 2018  路  1Comment  路  Source: reactjs/react-rails

hi i use this library. but prerender true component is not import css

component code this.

import React from 'react';
import styles from './styles.css';

class Hello extends React.Component {
  render() {
    return (
      <div>
        <p className={styles.title}>Hello !!</p>
      </div>
    )
  }
}

export default Hello;

css loader code is this

const ExtractTextPlugin = require('extract-text-webpack-plugin');

module.exports = {
  test: /\.css/,
  loader: ExtractTextPlugin.extract({
    loader: [
      {
        loader: 'css-loader',
        query: {
          localIdentName: '[hash:8]',
          modules: true
        }
      }
    ]
  })
}

why not import css?

Most helpful comment

Have you followed the instructions webpacker provides?
https://github.com/rails/webpacker/blob/master/docs/css.md
Usually the <%= stylesheet_pack_tag 'application' %> gets missed.

>All comments

Have you followed the instructions webpacker provides?
https://github.com/rails/webpacker/blob/master/docs/css.md
Usually the <%= stylesheet_pack_tag 'application' %> gets missed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hieuhlc picture hieuhlc  路  4Comments

wenwei63029869 picture wenwei63029869  路  3Comments

ghost picture ghost  路  4Comments

okolomoets picture okolomoets  路  5Comments

chrismv48 picture chrismv48  路  3Comments