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.

export-namespace-from is not respected

See original GitHub issue

Describe the bug Seems like export-namespace-from is not respected when used with Next.js

/sandbox/node_modules/react-dnd/dist/esm/index.js:1
export * from './common';
^^^^^^

SyntaxError: Unexpected token export
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.react-dnd (/sandbox/.next/server/static/development/pages/index.js:1298:18)
    at __webpack_require__ (/sandbox/.next/server/static/development/pages/index.js:23:31)
    at Module../pages/index.js (/sandbox/.next/server/static/development/pages/index.js:1087:67)
    at __webpack_require__ (/sandbox/.next/server/static/development/pages/index.js:23:31)
    at Object.3 (/sandbox/.next/server/static/development/pages/index.js:1132:18)
    at __webpack_require__ (/sandbox/.next/server/static/development/pages/index.js:23:31)
    at /sandbox/.next/server/static/development/pages/index.js:91:18
    at Object.<anonymous> (/sandbox/.next/server/static/development/pages/index.js:94:10)
    at Module._compile (internal/modules/cjs/loader.js:776:30)

Reproduction

Live Reproduction

Steps to reproduce the behavior:

  1. start any project with Next.js
  2. install react-dnd
  3. run the yarn dev

Expected behavior It should get complied

Although, the same works with CRA, demo here

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

3reactions
SunXinFeicommented, Nov 4, 2019

when I npm install will get the error “”

@kuldeepkeshwar, @miguelpel I had the same issue and maybe this can help you Similar discussion about module transpiling: https://spectrum.chat/next-js/general/have-no-idea-how-to-combine-amchart-with-next-js~37b6a631-663c-4a3c-94a0-568991f275de the package itself: https://www.npmjs.com/package/next-transpile-modules

But what described above hadn’t helped me, so I did how described here and it worked #1414 and use these libraries: https://www.npmjs.com/package/react-dnd-html5-backend-cjs https://www.npmjs.com/package/react-dnd-cjs

===============

the version of react-dnd is 9.3.x; when npm install react-dnd& npm install react-dnd-html5-backend will get the error is "Unexpected token export "; ===============||you can do this||========= =>npm uninstall react-dnd & npm uninstall react-dnd-html5-backend =>npm install react-dnd-cjs npm install react-dnd-html5-backend-cjs => and change the import :

import { DndProvider } from 'react-dnd-cjs'
import HTML5Backend from 'react-dnd-html5-backend-cjs'

will be ok; thks

2reactions
Oleksandr-kopaevichcommented, Aug 18, 2019

@kuldeepkeshwar, @miguelpel I had the same issue and maybe this can help you Similar discussion about module transpiling: https://spectrum.chat/next-js/general/have-no-idea-how-to-combine-amchart-with-next-js~37b6a631-663c-4a3c-94a0-568991f275de the package itself: https://www.npmjs.com/package/next-transpile-modules

But what described above hadn’t helped me, so I did how described here and it worked https://github.com/react-dnd/react-dnd/issues/1414 and use these libraries: https://www.npmjs.com/package/react-dnd-html5-backend-cjs https://www.npmjs.com/package/react-dnd-cjs

Read more comments on GitHub >

github_iconTop Results From Across the Web

export-namespace-from is not respected · Issue #8404 - GitHub
Describe the bug Seems like export-namespace-from is not respected when used with Next.js ...
Read more >
Export namespace should be first transformed by `@babel ...
I get the following error when I want to build my APK. Export namespace should be first transformed by @babel/plugin-proposal-export-namespace- ...
Read more >
@babel/plugin-proposal-export-namespace-from | Yarn - Yarn
Fast, reliable, and secure dependency management.
Read more >
babel/plugin-proposal-export-namespace-from
NOTE**: This plugin is included in `@babel/preset-env`, in [ES2020](https://github.com/tc39/proposals/blob/master/finished-proposals.md)
Read more >
npms.io search
@babel/plugin-proposal-export-namespace-from(7.12.13) ... Offers getProxyForUrl to get the proxy URL for a URL, respecting the *_PROXY (e.g. HTTP_PROXY) and ...
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