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.

"Module parse failed" running next dev in 8.1.1-canary.28

See original GitHub issue

Bug report

Describe the bug

Running next dev in my project is causing a Module parse failed: Unexpected token error when trying to compile next/dist/client/next-dev.js:

Module parse failed: Unexpected token (19:6)
You may need an appropriate loader to handle this file type.
|
|
> import('./noop'); // Support EventSource on Internet Explorer 11
|
| if (!window.EventSource) {

To Reproduce

My babel configuration is:

{
  presets: [
    [
      'next/babel',
      {
        'preset-env': {
          useBuiltIns: 'usage',
        },
      },
    ],
    '@babel/preset-typescript'
  ],
  plugins: [
    ['@babel/plugin-proposal-decorators', { legacy: true }],
    ['@babel/plugin-proposal-class-properties', { loose: true }],
  ]
}

I can reproduce even when my next.config.js does not modify the webpack config.

Expected behavior

Compilation should succeed

System information

  • Version of Next.js: 8.1.1-canary.28

Additional context

This is in a Yarn workspace–using monorepo, so the next package gets installed in a node_modules that’s a few directories up from where my source is.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
ijjkcommented, May 15, 2019

Or is just “try to shuffle your dependencies around until #6940 is implemented”

This seems to be the case for now, although we have prioritized #6940 I’m gonna close this issue in favor of the mentioned one, if you have any additional information that you think is helpful feel free to add it to that thread.

1reaction
ijjkcommented, May 15, 2019

Awesome thanks 🙏, by included I mean when you add the next/babel it already adds @babel/preset-typescript

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Module parse failed" running next dev in 8.1.1-canary.28 #7344
Bug report Describe the bug Running next dev in my project is causing a Module parse failed: Unexpected token error when trying to...
Read more >
Webpack in NextSJ Config - ModuleParseError: Module parse ...
I getting error while building from nextjs app or starting server with yarn dev command. This is next.config.js. it was work correctly until ......
Read more >
8.1.1-canary.70 - next - npm
Start using next in your project by running `npm i next`. There are 2736 other projects in the npm registry using next.
Read more >
Package Diff: next @ 8.1.1-canary.25 .. 8.1.1-canary.28
Visual diff of the npm package 'next' comparing 8.1.1-canary.25 with 8.1.1-canary.28.
Read more >
Next NPM | npm.io
Next.js is a minimalistic framework for server-rendered React applications. ... and then just run npm run dev and go to http://localhost:3000 .
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