GithubHelp home page GithubHelp logo

flex-development / aggregate-error-ponyfill Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 3.1 MB

ECMAScript Proposal spec-compliant ponyfill for AggregateError

Home Page: https://github.com/flex-development/aggregate-error-ponyfill

License: BSD 3-Clause "New" or "Revised" License

Shell 1.99% JavaScript 56.09% TypeScript 40.98% Ruby 0.65% Handlebars 0.29%
aggregate-error ecmascript es-proposal polyfill ponyfill typescript

aggregate-error-ponyfill's People

Contributors

dependabot[bot] avatar unicornware avatar

Stargazers

 avatar

Watchers

 avatar  avatar

aggregate-error-ponyfill's Issues

๐Ÿ› missing `default` exports

Prerequisites

  • read documentation
  • searched open issues for existing bug report
  • searched closed issues for solution(s) or feedback

Current behavior

the default export is not available when running the project as a commonjs module:

class Exception extends import_aggregate_error_ponyfill.default {
                                                        ^

TypeError: Class extends value #<Object> is not a constructor or null
    at Object.<anonymous> (/Users/lex/Desktop/exceptions/dist/exceptions/base.exception.cjs:39:57)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/lex/Desktop/exceptions/dist/exceptions/index.cjs:32:27)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)

Reproduction

git clone https://github.com/flex-development/exceptions ~/Desktop/exceptions
cd ~/Desktop/exceptions
git checkout 5406594fe0722c3c3780eef5ef1f41cbcca50a54
yarn
yarn add @flex-development/[email protected]
yarn build
node dist/index.cjs

/Users/lex/Desktop/exceptions/dist/exceptions/base.exception.cjs:39
class Exception extends import_aggregate_error_ponyfill.default {
                                                        ^

TypeError: Class extends value #<Object> is not a constructor or null
    at Object.<anonymous> (/Users/lex/Desktop/exceptions/dist/exceptions/base.exception.cjs:39:57)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/lex/Desktop/exceptions/dist/exceptions/index.cjs:32:27)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)

Expected behavior

git clone https://github.com/flex-development/exceptions ~/Desktop/exceptions
cd ~/Desktop/exceptions
git checkout 5406594fe0722c3c3780eef5ef1f41cbcca50a54
yarn
yarn add @flex-development/[email protected]
yarn build
node dist/index.cjs

Package version

2.0.0

Node.js version

v16.17.0

Package manager version

[email protected]

Operating system (environment)

macos

Additional context

  • console.debug output

    console.debug(import_aggregate_error_ponyfill) // { default: [Getter] }
    console.debug(import_aggregate_error_ponyfill.default) // { default: [Getter] }
    console.debug(import_aggregate_error_ponyfill.default.default) // [class G extends Error]
  • this is actually an esbuild issue

    • evanw/esbuild#2026

      Setting "type": "module" in your package.json means "I need to use node's behavior" for both Webpack and esbuild. If you don't need node's behavior, then just remove "type": "module" from your package.json.

      - #issuecomment-1043162272

      unfortunately, this logic does not account for needing "type": "module" in development (e.g. running tests + running scripts in package.json), but not when building commonjs modules. toggle-pkg-type was created to circumvent this issue, however. it is a cli tool that can disable and enable type in package.json. it should be used in the project's build script:

      {
        "scripts": {
          "build": "toggle-pkg-type && mkbuild; toggle-pkg-type"
        }
      }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.