Giter Club home page Giter Club logo

Comments (3)

tmcw avatar tmcw commented on June 14, 2024

Are you using CommonJS or es6 imports? Can you share a link to the source code, or any other details?

from gulp-documentation.

kwhitaker avatar kwhitaker commented on June 14, 2024

@tmcw I'm using ES6 imports.

Here's a snippet of the source code:

import {connect} from 'react-redux'
import {fetchConfig} from 'state/config'
import Config from 'components/ecosystems/config'
import React, {PropTypes} from 'react'
import TitleBar from 'components/molecules/title-bar'
import NotFound from 'components/organisms/not-found'
import SiteFooter from 'components/atoms/site-footer'
import './global.sass'

/**
 * The Layout component is the top-level component of the app.
 */
export class Layout extends React.Component {

  static propTypes = {
    config: PropTypes.shape({
      existing: PropTypes.bool,
      error: PropTypes.object,
      loading: PropTypes.bool.isRequired,
      serverSettings: PropTypes.shape({
        hostName: PropTypes.string,
        userName: PropTypes.string,
        password: PropTypes.string,
        version: PropTypes.string,
      }),
    }),
    development: PropTypes.bool,
    dispatch: PropTypes.func,
    fetchConfig: PropTypes.func,
    router: PropTypes.shape({
      url: PropTypes.string,
      route: PropTypes.shape({
        name: PropTypes.string,
        options: PropTypes.object,
      }),
    }),
  };

  componentDidMount() {
    this.props.fetchConfig()
  }

  /**
   * Only include DevTools if in development.
   * @returns {React.Component}
   */
  renderDevTools() {
    if (this.props.development) {
      const DevTools = require('utils/dev-tools')
      return <DevTools/>
    }
    return null
  }

  /**
   * Return the main content selected by the current route.
   * @returns {React.Component}
   */
  renderMainContent() {
    const {config} = this.props
    if (!config.existing) {
      return <Config isFetching={config.loading}/>
    }

    switch (this.props.router.route.name) {
      case 'config':
        return <Config/>
      default:
        return <NotFound path={this.props.router.url}/>
    }
  }

  render() {
    const {config, router} = this.props
    const existingConfig = config.existing && !config.loading

    return (
      <div>
        <TitleBar currentRoute={router.route.name} showNav={existingConfig}/>
        {this.renderMainContent()}
        <SiteFooter version={config.serverSettings.version}/>
        {this.renderDevTools()}
      </div>
    )
  }

}

export default connect(
  state => ({
    router: state.router,
    config: state.config.toJS(),
  }), {fetchConfig}
)(Layout)

from gulp-documentation.

jgrauel avatar jgrauel commented on June 14, 2024

I am having the same issue with CommonJS requires.

from gulp-documentation.

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.