-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error parsing triggers: Cannot find module 'csv-parse/sync' #323
Comments
I have never used firebase so I might pass on this one. |
Ok. Posted a similar question on SO: https://stackoverflow.com/questions/71232999/error-parsing-triggers-cannot-find-module-csv-parse-sync |
I have a similar issue outside of firebase in a plain TypeScript script using version 5.0.4 |
Edit: Jest 28 no longer has this issue: #323 (comment) Version
import {generate, parse, transform, stringify} from 'csv/sync';
test('empty test', () => {}); Running
Workaround for Jest (throws in Node.js): import { parse, stringify } from 'csv/dist/esm/sync'; Throws this error in Node.js:
Workaround for both Jest and Node.js: import { parse, stringify } from './node_modules/csv/dist/esm/sync.js'; |
Am getting the same issue as others have reported attempted to bind dep with
Workaround only gets me this: |
@bnwa check inside your Should be in the |
Using |
Nice! I guess it should also work with |
TS won't match the declaration file when called with ESM syntax for whatever reason |
This is no longer throwing on Jest 28 🎉 Thanks to support for the So the version from the docs can now be used with Jest. (although due to import-js/eslint-plugin-import#1810 it is still incompatible with |
I have this problem on Expressjs app node version 12+, and also run the project with node 10, 12 , 14 ,16.What I tried:
SyntaxError: Unexpected token export
|
As you can see in the csv-parse package.json file the lib/sync is exported
// ...
"exports": {
".": {
"import": "./lib/index.js",
"require": "./dist/cjs/index.cjs",
"types": "./lib/index.d.ts"
},
"./sync": {
"import": "./lib/sync.js",
"require": "./dist/cjs/sync.cjs",
"types": "./lib/sync.d.ts"
},
"./browser/esm": {
"types": "./lib/index.d.ts",
"default": "./dist/esm/index.js"
},
"./browser/esm/sync": {
"types": "./lib/sync.d.ts",
"default": "./dist/esm/sync.js"
}
// ... |
This is still an issue... Using latest version If you do
You get
If you do
You get
To help with debugging, this is my script's
|
This is a nightmare |
Had a related problem compiling with pkg. TS using modules would work using |
@wdavidw maybe this is actually a problem in the published version of (this also happens for
|
Yeah, if you expand the details, you can see the problem.
but that directory doesn’t contain an index.js; it contains an index.cjs. https://unpkg.com/browse/csv-parse@5.4.0/dist/cjs/ |
Pretty sure it comes from packages/csv-parse/rollup.config.js but I've never used Rollup so I might be wrong. Any Rollup expert over here? |
Could you check the latest version 5.4.1 with Are types wrong ?, the "csv-parse/sync" with node16 from CJS is now ok after the changes from #397. |
Hm, I just tried upgrading to |
Still have the issue. Eslint is looking for "/node_modules/csv-parse/dist/esm/sync" instead of "/node_modules/csv-parse/lib/sync". This is weird because the package.json looks correct. I'm using TypeScript btw. Is it only a TS issue? Is it just me? |
Me too, with TS and csv-parse. And I don't want to install whole |
Describe the bug
When I try to use csv-parse/sync instead of csv-parse, my deploy to Firebase Functions fail with the following error:
To Reproduce
Import using:
import { parse } from 'csv-parse/sync';
Then use in code like this:
I have installed by going to /functions-folder and running
npm install --save csv-parse
Deploying in root folder with
firebase deploy
Additional context
Is this an issue with the framework, with firebase or am I doing something wrong? Normal use of "csv-parse" without sync works just fine.
The text was updated successfully, but these errors were encountered: