Skip to content

1.7.2 js module config fails to load #2924

Closed

Description

@wejendorp

Prettier 1.7.2

# myConfig.js
module.exports = { semi: true };
$ prettier --config ./myConfig.js index.js
Error: Invalid configuration file.
Failed to parse "[..]/myConfig.js" as JSON, JS, or YAML.

Expected behavior:
Should load js module as config.

Activity

  1. ikatyang commented on Sep 28, 2017

    @ikatyang
    Member

    steps to reproduce:

    mkdir test
    cd test
    yarn --init
    yarn add prettier
    echo 'module.exports = { \nsemi: true\n };' > myConfig.js
    echo 'const x = 1' > index.js
    node_modules/.bin/prettier --config myConfig.js index.js

    I found it works fine with unbundled version, it seems something wrong with bundling for consmiconfig's require-from-string module, module.parent is missing.

    cc @azz @lydell


    As a temporary workaround, you can install prettier from github:

    npm install prettier/prettier
  2. bstream commented on Sep 28, 2017

    @bstream

    Regression from 1.7.0

  3. added
    priority:high
    on Sep 28, 2017
  4. suchipi commented on Sep 29, 2017

    @suchipi
    Member

    Should we release a 1.7.3 with this fix? (seeing as it's labeled high-pri)

  5. lydell commented on Sep 30, 2017

    @lydell
    Member

    @suchipi Yes, that would be very good.

  6. azz commented on Sep 30, 2017

    @azz
    Member

    Just published 1.7.3

  7. wejendorp commented on Oct 2, 2017

    @wejendorp
    Author

    Great, thanks for the quick fix! 💪

  8. added
    locked-due-to-inactivity
    on Jul 6, 2018
  9. locked as resolved and limited conversation to collaborators on Jul 6, 2018
  10. added theissue type on Mar 3, 2025
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

    locked-due-to-inactivitypriority:high

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions