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

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

Closed
wood1986 opened this issue Nov 19, 2019 · 10 comments · Fixed by #1721
Closed

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

wood1986 opened this issue Nov 19, 2019 · 10 comments · Fixed by #1721
Labels

Comments

@wood1986
Copy link

wood1986 commented Nov 19, 2019

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
/

@wood1986
Copy link
Author

wood1986 commented Nov 21, 2019

Add @TheLarkInn

@TheLarkInn
Copy link
Member

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

@evenstensberg
Copy link
Member

Considered!

@evenstensberg
Copy link
Member

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

@evenstensberg evenstensberg 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 Nov 22, 2019
@wood1986
Copy link
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?

@evenstensberg
Copy link
Member

I think that the edit needs to be done here:

https://github.com/webpack/webpack-cli/blob/next/lib/groups/config.js#L86-L88

@anikethsaha
Copy link
Member

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

@ematipico
Copy link
Contributor

Is it fixed with latest beta?

@alexander-akait
Copy link
Member

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

@anshumanv
Copy link
Member

Done @evilebottnawi 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants