0

After upgrading from 0.11.0 to 0.13.3 this error. What could be wrong? I can not understand what was going on , because a comment jsx in place before everything worked.

/**
 * @jsx React.DOM
 */
'use strict';
// config
var config = require('./config');
// dependencies
var React = require('react');
var ReactAsync = require('react-async');
// custom components
var Head = require('./modules/components/head');
// Main page component (this is asynchronous)
var NotFound = React.createFactory(
    React.createClass({
        displayName: 'NotFoundApp',
        mixins: [ReactAsync.Mixin],
        getInitialStateAsync: function (callback) {
            callback(null, this.props); // set the input props as state (equal to 'return this.props' in getInitialState, but async)
        },

        render: function() {
            return (
                <html>
                    //here is error
                </html>
            );
        }
    })
);
module.exports = NotFound;
if (typeof window !== 'undefined') {
    // enable the react developer tools when developing (loads another 450k into the DOM..)
    if (config.environment == 'development') {
        window.React = require('react');
    }
    window.onload = function () {
        React.renderComponent(NotFound(), document);
    }
}

Here is gulp task for browserify:

var browserify = require('browserify');
var streamify = require('gulp-streamify');
var NopStream = require('../util/no-op-stream');
var uglify = require('gulp-uglify');
var gulp = require('gulp');
var handleErrors = require('../util/handle-errors');
var bundleLogger = require('../util/bundle-logger');
var source = require('vinyl-source-stream');
var watchify = require('watchify');
var gutil = require('gulp-util');

var production = process.env.NODE_ENV === 'production';

function createBundles(bundles, callback) {
    var bundleQueue = bundles.length;

    function reportFinished(bundleOptions) {
        bundleLogger.end(bundleOptions.output);

        if (bundleQueue) {
            bundleQueue--;
            if (bundleQueue === 0) {
                callback();
            }
        }
    }

    function createSingleBundle(bundler, bundleOptions) {
        bundleLogger.start(bundleOptions.output);

        bundler.bundle()
            .on('error', handleErrors)
            .pipe(source(bundleOptions.output))
            .pipe(production ? streamify(uglify()) : (new NopStream()))
            .pipe(gulp.dest(bundleOptions.destination))
            .on('end', function() {
                reportFinished(bundleOptions);
            });
    }

    bundles.forEach(function(bundleOptions) {
        var bundler = browserify({
            debug: !production,
            cache: {},
            packageCache: {},
            fullPaths: true,
            entries: bundleOptions.input,
            extensions: bundleOptions.extensions
        });

        if (global.isWatching) {
            bundler = watchify(bundler);

            // Rebundle on update
            bundler.on('update', function() {
                createSingleBundle(bundler, bundleOptions);
            });
        }

        createSingleBundle(bundler, bundleOptions);
    });
}

gulp.task('browserify', function(callback) {
    if(global.isWatching) {
        gutil.log('Watchify is enabled!');
    }

    createBundles([{
        input: ['./client/javascript/app.js'],
        output: 'app.js',
        destination: './client/public/javascript/'
    }, {
        input: ['./client/javascript/article.js'],
        output: 'article.js',
        destination: './client/public/javascript/'
    }, {
        input: ['./client/javascript/404.js'],
        output: '404.js',
        destination: './client/public/javascript/'
    }], callback);
});
3
  • 1
    Try removing the pragma mark at the top. Commented Jun 12, 2015 at 14:32
  • Try just <html /> like that (self closing XML-style tag). Commented Jun 12, 2015 at 15:13
  • Are you getting this error in the browser console? If so, your JSX is most likely not getting compiled. Commented Apr 25, 2016 at 14:47

1 Answer 1

1

Try adding type="text/babel" to your script file in the entry file

Like this <script src="example.js" type="text/babel"></script>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.