Skip to content

[BUG]: [email protected] no longer supports function-export-based webpack.config.js #1126

Closed

Description

@wood1986

Describe the bug

When my webpack.config.js is exporting a function instead of a simple object. Webpack won't recognize my config anymore. I have checked your test case on your next branch and I do not see any webpack.config.js which is exporting a function. When I export an object, it works Are you work in progress? Or Will you deprecate that kind of export?

What is the current behavior?

See the previous

To Reproduce

use this webpack.config.js

module.exports = (env, argv) => {
  return {
    "entry": {
      "web.index": path.resolve(__dirname, "src", "web.index.jsx")
    },
    "output": {
      "filename": `[name].${argv.mode}.[chunkhash].js`,
      "libraryTarget": "umd",
      "path": path.resolve(__dirname, "dist")
    }
  }
}

and then run

webpack-cli --config=./webpack.config.js

Expected behavior
/

Screenshots
/

Please paste the results of webpack-cli info here, and mention other relevant information

webpack: next
webpack-cli: 4.0.0-beta.1
node: 13.1.0
OS: macOS 10.15.1

Additional context
/

Activity

  1. wood1986 commented on Nov 21, 2019

    @wood1986
    Author
  2. TheLarkInn commented on Nov 21, 2019

    @TheLarkInn
    Member

    cc @evenstensberg this is considered a release-blocking bug.

  3. evenstensberg commented on Nov 22, 2019

    @evenstensberg
    Member

    Considered!

  4. evenstensberg commented on Nov 22, 2019

    @evenstensberg
    Member

    Thx for your bug report @wood1986 , appreciate you putting in the time ❤️

  5. changed the title [-][email protected] no longer supports function-export-based webpack.config.js[/-] [+][BUG]: [email protected] no longer supports function-export-based webpack.config.js[/+] on Nov 22, 2019
  6. wood1986 commented on Nov 23, 2019

    @wood1986
    Author

    I have one more request. webpack-cli 3 has a private function

    function processOptions(options) {
    to convert function-export-base to the real object. I want to reuse but it is not exposed. In webpack-cli 4, is it possible to expose that?

  7. anikethsaha commented on Nov 27, 2019

    @anikethsaha
    Contributor

    Not sure why this bug is happening but the tests seems fine and passing for config type function

    https://github.com/webpack/webpack-cli/tree/next/test/config/type/function

    Screenshot_2019-11-27-15-09-17-544_com android chrome

  8. ematipico commented on Feb 29, 2020

    @ematipico
    Contributor

    Is it fixed with latest beta?

  9. alexander-akait commented on Aug 1, 2020

    @alexander-akait
    Member

    /cc @anshumanv fixed by #1721? Can you include it in the PR message?

  10. anshumanv commented on Aug 1, 2020

    @anshumanv
    Contributor

    Done @evilebottnawi 👍

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

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions