Skip to content
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

Handle top level json array #761

Merged
merged 1 commit into from
Sep 29, 2021
Merged

Handle top level json array #761

merged 1 commit into from
Sep 29, 2021

Conversation

GrosSacASac
Copy link
Contributor

fixes #760

@Rush have a try

@GrosSacASac GrosSacASac changed the base branch from master to 3.x September 26, 2021 17:43
@Rush
Copy link

Rush commented Sep 27, 2021

@GrosSacASac gladly but this branch is ESM only so it's no-go :-(

» node index.js
internal/modules/cjs/loader.js:1089
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /code/formidable-test/node_modules/formidable/src/index.js
require() of ES modules is not supported.
require() of /code/formidable-test/node_modules/formidable/src/index.js from /code/formidable-test/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename /code/formidable-test/node_modules/formidable/src/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /code/formidable-test/node_modules/formidable/package.json.

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/code/formidable-test/index.js:2:20)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12) {
  code: 'ERR_REQUIRE_ESM'
}

ESM reminds me of Python 2 to Python 3 migration. A never-ending story with no happy ending :-(

@GrosSacASac
Copy link
Contributor Author

Make it a yes-go :)

@GrosSacASac GrosSacASac merged commit 9ea44c5 into 3.x Sep 29, 2021
@GrosSacASac GrosSacASac deleted the handle-top-level-json-array branch September 29, 2021 11:05
@Rush
Copy link

Rush commented Sep 29, 2021

Sorry I didn't have time to test with ESM yet.

GrosSacASac added a commit that referenced this pull request Oct 30, 2021
* chore: start version 3

* feat: Use ES modules (#727)

* feat: Url search params and remove multiple (#730)

* docs: Fixed the missing "=" in options.filter (#732)

* docs: fix example

* docs: specify what part actually is

* docs: fix types

* docs: add warning for progress event

* docs: finish removing multiples in examples

* docs: add example for express as middleware

* docs: example handle common internet errors

* feat: add corepack support

* fix: corepack support

* fix: fix examples comment

* fix: fix example comment

* feat: add firstValues, readBooleans helpers (#757)

* feat: add firstValues, readBooleans helpers

* feat: export types

* docs: document helpers

* docs: fix example

* fix: #760 (#761)

* fix: fix error when there is an error

* tests: fix some of the tests  (#763)

* chore: up supertest jest and nyc

* tests: convert to import , fix some tests

* test: make malformed boundary as per comment ?

* tests: refactor

* style: fix some prettier issues (#764)

* chore: publish as 3.x tag

* docs: add changelog link

* docs: typo

Co-authored-by: Hrushikesh Das <[email protected]>
Co-authored-by: Jimmy Wärting <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Top-level JSON arrays are interpreted as objects
2 participants