vendredi 11 mai 2018

Why does my code run fine in node but gives "unexpected token" when trying to use browserify?

When I do node index.js my file runs without errors but as soon as I do, browserify index.js --standalone foo > app.js I get this error: Unexpected token (369:8) while parsing /path_to_file/index.js - for reference here is the function containing line 369:

function createType(attrs = {}) {
    return {
        name: '<missing name>',
        aliasOfName: '',
        arrayOf: null,
        optionalOf: null,
        baseName: '',
        base: null,
        fields: [],
        serialize: serializeUnknown,
        deserialize: deserializeUnknown,
        ...attrs

    }; <------ Line 369

}

When I comment out the function, the same error comes again but for a different completely different line. I cannot figure out why this is happening since the file runs fine when I run it with node.




Aucun commentaire:

Enregistrer un commentaire