GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Bug]: @babel/parser: __esModule property is not defined in lib/index.js since version 7.22.11 · Issue #15934 · babel/babel

[Bug]: @babel/parser: __esModule property is not defined in lib/index.js since version 7.22.11 #15934

New issue
Copy link
New issue
Copy link
Closed
#15935
Closed
[Bug]: @babel/parser: __esModule property is not defined in lib/index.js since version 7.22.11#15934
#15935
Copy link
Labels
i: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Description

@tkallage
tkallage
opened on Sep 6, 2023
Issue body actions

💻

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

working in 7.22.10:
npm i @babel/[email protected] [email protected]
run in node REPL:

require('local-pkg').importModule('@babel/parser').then(({parse}) => console.log(parse))

Result: [Function: parse]

not working in 7.22.11:
npm i @babel/[email protected] [email protected]
run in node REPL:

require('local-pkg').importModule('@babel/parser').then(({parse}) => console.log(parse))

Result: undefined

And

require('local-pkg').importModule('@babel/parser').then(({default: {parse}}) => console.log(parse))

Result: [Function: parse]

Configuration file name

No response

Configuration

No response

Current and expected behavior

unplugin-vue-components uses importModule() from the package local-pkg to import @babel/parser.
It recognizes the property __esModule to import the default export of @babel/parser.

With @babel/parser 7.22.10 this works fine, but since 7.22.11 the esModule-marker is missing in the resulting lib/index.js file, resulting in the imported object { default: { parser(), ... } } instead of { parser(), ... }.

Environment

System:
OS: Windows 10 10.0.22621
Binaries:
Node: 18.12.0 - C:\Program Files\nodejs\node.EXE
npm: 9.8.1 - <project_path>\node_modules.bin\npm.CMD
pnpm: 8.5.0 - C:\Program Files\nodejs\pnpm.CMD
npmPackages:
@babel/parser: ^7.22.11 => 7.22.11
@babel/runtime: ^7.22.11 => 7.22.11
eslint: ^8.48.0 => 8.48.0

Possible solution

Add

Object.defineProperty(exports, '__esModule', {
  value: true
});

at the top of the resulting file /lib/index.js in @babel/parser

Additional context

grafik
grafik

Activity

  1. tkallage
    added
    i: needs triage
    on Sep 6, 2023
  2. tkallage
    changed the title [-][Bug]: __esModule property is not defined in lib/index.js since version 7.22.11[/-] [+][Bug]: @babel/parser: __esModule property is not defined in lib/index.js since version 7.22.11[/+] on Sep 6, 2023
  3. babel-bot commented on Sep 6, 2023

    @babel-bot
    babel-bot
    on Sep 6, 2023
    Collaborator
    More actions

    Hey @tkallage! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

    If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

  4. liuxingbaoyu
    added
    i: regression
    and removed
    i: needs triage
    on Sep 6, 2023
  5. nicolo-ribaudo commented on Sep 6, 2023

    @nicolo-ribaudo
    nicolo-ribaudo
    on Sep 6, 2023
    Member
    More actions

    I'm incredibly confused by how this could have happened

  6. liuxingbaoyu commented on Sep 6, 2023

    @liuxingbaoyu
    liuxingbaoyu
    on Sep 6, 2023
    Member
    More actions

    @nicolo-ribaudo #15038 I guess it is.

  7. nicolo-ribaudo commented on Sep 6, 2023

    @nicolo-ribaudo
    nicolo-ribaudo
    on Sep 6, 2023
    Member
    More actions

    As a quick fix, we could just concatenate Object.defineProperty(exports, "__esModule", { value: true }) to the file generated by rollup.

  8. liuxingbaoyu commented on Sep 6, 2023

    @liuxingbaoyu
    liuxingbaoyu
    on Sep 6, 2023
    Member
    More actions

    I found a workaround and will open a PR later. :)

  9. nicolo-ribaudo
    closed this as completedin #15935on Sep 6, 2023
  10. tkallage commented on Sep 7, 2023

    @tkallage
    tkallage
    on Sep 7, 2023
    Author
    More actions

    Thanks for the fast fix! ♥️

  11. github-actions
    added
    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue
    on Dec 8, 2023
  12. github-actions
    locked as resolved and limited conversation to collaborators on Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.