published package is missing commonjs code
See original GitHub issueVersion 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:
- Created 4 years ago
- Reactions:2
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jhuleatt we’ll want to build for more than one target before publish. I’ll build that into the pipeline.
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.