Code Monkey home page Code Monkey logo

Comments (6)

clauderic avatar clauderic commented on May 20, 2024

You most likely forgot to import the styles or don't have the appropriate webpack loader. You need to make sure to import the default stylesheet:

 import 'react-infinite-calendar/styles.css';

from react-infinite-calendar.

yingw787 avatar yingw787 commented on May 20, 2024

Hi clauderic, thanks for the tip; I'm still having some trouble with including the .css file though. I added in import 'react-infinite-calendar/styles.css'; into the file and I get back a module parse failed error. I'm not sure what's wrong as my webpack css loader looks to match webpack's recommended layout. I also tried require('react-infinite-calendar/styles.css') and require('css!react-infinite-calendar/styles.css') to no avail. I was wondering whether you could help take a look at my webpack config and file (included below):

webpack.config.js

`var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: path.join(__dirname, '/app/index.html'),
filename: 'index.html',
inject: 'body',
});

module.exports = {
entry: [
'./app/index.js',
],
output: {
path: path.join(__dirname, '/dist'),
filename: 'index_bundle.js',
},
module: {
loaders: [
{
test: /.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015'],
},
},
{
test: /.css$/,
loader: 'style-loader!css-loader',
},
],
},

plugins: [
    HtmlWebpackPluginConfig,

],

};
`

file.js

`const React = require('react');
const TraveltileSubcardDialogWrapper = require('./TraveltileSubcardDialogWrapper');
const PropTypes = React.PropTypes;

import InfiniteCalendar from 'react-infinite-calendar';
import 'react-infinite-calendar/styles.css';

const TraveltileSubcardDialogItinerary = React.createClass({
propTypes: {
onCloseDialog: PropTypes.func.isRequired,
},
_handlePickDate(date) {
alert(date);
},
render() {
// TODO: need to fix problems in render function of TraveltileSubcardDialogItinerary that prevent BigCalendar from rendering properly.
return (
<TraveltileSubcardDialogWrapper
title = {"Itinerary"}
onCloseDialog = {this.props.onCloseDialog}>


);
},
});

module.exports = TraveltileSubcardDialogItinerary;
`

from react-infinite-calendar.

yingw787 avatar yingw787 commented on May 20, 2024

Never mind it works! +1

from react-infinite-calendar.

clauderic avatar clauderic commented on May 20, 2024

I believe you were missing style-loader. Glad you got it to work 👍

from react-infinite-calendar.

pjr87 avatar pjr87 commented on May 20, 2024

I have the same issue, how did you get it to work?

from react-infinite-calendar.

yingw787 avatar yingw787 commented on May 20, 2024

I don't remember at all, but I think it was something to do with installing the proper loaders. One thing I didn't notice immediately in Webpack was that you need to call the loaders in the proper order, i.e. 'style-loader', 'css-loader' is not the same as 'css-loader', 'style-loader'.

from react-infinite-calendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.