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.

published package is missing commonjs code

See original GitHub issue

Version info

ReactFire: 2.0.0

Other (e.g. Node, browser, operating system) (if applicable): “next”: “9.0.5”, “typescript”: “^3.5.3”

Test case

I just started a new project with next.js and stumbled on this new version of reactfire, I was excited to give it a try but was immediately disappointed by:

/home/[REDACTED]/node_modules/reactfire/index.js:1
export * from './auth';
^^^^^^

SyntaxError: Unexpected token export

So I opened the reactfire package and found that it doesn’t contain commonjs version of source code.

Steps to reproduce

  • create a next.js based project with typescript support
  • add reactfire and import it in index.tsx

Expected behavior

Package published on npm should contain valid/runnable node.js code.

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
jamesdanielscommented, Oct 18, 2019

@jhuleatt we’ll want to build for more than one target before publish. I’ll build that into the pipeline.

1reaction
shawnmmatthewscommented, Nov 5, 2019

Just as a heads up for anyone that comes across this prior to the update being available. I’ve been able to get this working by building reactfire using “module”: “commonjs” in the tsconfig.json file, and then running the context provider from within a module with ssr: false enabled in Next.

Read more comments on GitHub >

github_iconTop Results From Across the Web

All you need to know to move from CommonJS to ECMAScript ...
We have a lot to cover, so let's jump into it! Enabling ECMAScript modules (ESM) in Node.js; Syntax; Strict by default; Browser compatibility ......
Read more >
Missing type definition information in VS Code when own ...
Missing type definitions when referencing the published package: import { CrmRpc} from "efficy-enterprise-api"; const crm = new ...
Read more >
How to Create a Hybrid NPM Module for ESM and CommonJS.
Generates a hybrid package for either ESM or CommonJS. Single Source Base. Author your code in ES6, ES-Next or Typescript using import and ......
Read more >
Publishing NPM Packages as Native ES Modules - Medium
Historically, Node.js used the CommonJS import system, ... using ES imports and exports in your code, but not publishing as an ES module, ......
Read more >
Node Modules at War: Why CommonJS and ES ... - Code Red
You can opt-in to ESM mode by renaming your script from .js to .mjs . Alternately, you can set "type": "module" in package.json...
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