question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Canary branch still getting the "SyntaxError: Unexpected identifier" error for imports

See original GitHub issue

I upgraded to the canary version however I’m still getting the following error:

SyntaxError: Unexpected identifier
    at new Script (vm.js:80:7)
    at createScript (vm.js:274:10)
    at Object.runInThisContext (vm.js:326:10)
    at Module._compile (internal/modules/cjs/loader.js:664:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.@tidyiq/core/next/_app (C:\Users\Me\Websites\Boilerplate\dist\.next\server\static\development\pages\_app.js:1108:18)
    at __webpack_require__ (C:\Users\Me\Websites\Boilerplate\dist\.next\server\static\development\pages\_app.js:23:31)
    at Module../pages/_app.js (C:\Users\Me\Websites\Boilerplate\dist\.next\server\static\development\pages\_app.js:1049:79)
    at __webpack_require__ (C:\Users\Me\Websites\Boilerplate\dist\.next\server\static\development\pages\_app.js:23:31)
    at Object.0 (C:\Users\Me\Websites\Boilerplate\dist\.next\server\static\development\pages\_app.js:1096:18)
    at __webpack_require__ (C:\Users\Me\Websites\Boilerplate\dist\.next\server\static\development\pages\_app.js:23:31)
C:\Users\Me\Websites\Boilerplate\dist\node_modules\@tidyiq\core\next\_app.js:1
(function (exports, require, module, __filename, __dirname) { import React, { useEffect } from "react";

Contents of node_modules/@tidyiq/core/next/_app.js:

import React, { useEffect } from "react";
import CssBaseline from "@material-ui/core/CssBaseline";
import { ThemeProvider } from "@material-ui/styles";
import theme from "../theme/createTheme";
import { StateProvider } from "../state/store";
const AppProvider = ({ children }) => {
    useEffect(() => {
        const jssStyles = document.querySelector("#jss-server-side");
        if (jssStyles && jssStyles.parentNode) {
            jssStyles.parentNode.removeChild(jssStyles);
        }
    });
    return (React.createElement(StateProvider, null,
        React.createElement(ThemeProvider, { theme: theme },
            React.createElement(CssBaseline, null),
            children)));
};
export default AppProvider;

Contents of pages/app.js:

import React from "react";
import App, { Container } from "next/app";
import AppProvider from "@tidyiq/core/next/_app";
class MyApp extends App {
    render() {
        const { Component, pageProps } = this.props;
        return (React.createElement(Container, null,
            React.createElement(AppProvider, null,
                React.createElement(Component, Object.assign({}, pageProps)))));
    }
}
export default MyApp;

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
TidyIQcommented, Jul 3, 2019

OK I just updated to canary again. The error is:

node_modules/next-server/dist/server/render.d.ts:7:28 - error TS2307: Cannot find module 'next-server/types'.

7 import { PageConfig } from 'next-server/types';

I’ll create a separate issue for it

1reaction
TidyIQcommented, Jul 3, 2019

Oh sorry, you meant for the new issue with ReferenceError: exports is not defined. OK sure, I’ll provide a repo shortly

Read more comments on GitHub >

github_iconTop Results From Across the Web

Canary branch still getting the "SyntaxError: Unexpected ...
This looks like a webpack bug, for some reason it's not detecting commonjs and not providing the exports key. Can you please file...
Read more >
Unexpected identifier' for import statement using Jest with ...
Receiving error 'SyntaxError: Unexpected identifier' for import statement ... Previously, Jest worked fine with import statements; however, ...
Read more >
syntaxerror: unexpected identifier - You.com | The AI Search ...
Importing node.js module - SyntaxError: Unexpected identifier ... I upgraded to the canary version however I'm still getting the following error:.
Read more >
SyntaxError: Unexpected '#' used outside of class body
The JavaScript exception "Unexpected '#' used outside of class body" occurs when a hash ("#") is encountered in an unexpected context, most notably...
Read more >
Testing Guide - OWASP Foundation
The OWASP Testing Guide has an import- ant role to play in solving this serious issue. It is vitally important that our approach...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found