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

Invalid configuration object: mangleExports using 5.0.0-beta.14 #1677

Closed
JAicewizard opened this issue Apr 19, 2020 · 10 comments · Fixed by #1724
Closed

Invalid configuration object: mangleExports using 5.0.0-beta.14 #1677

JAicewizard opened this issue Apr 19, 2020 · 10 comments · Fixed by #1724

Comments

@JAicewizard
Copy link

Bug report

What is the current behavior?
When I use the example configuration for mangleExports:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.optimization has an unknown property 'mangleExports'. These properties are valid:
   object { checkWasmTypes?, chunkIds?, concatenateModules?, flagIncludedChunks?, hashedModuleIds?, mangleWasmImports?, mergeDuplicateChunks?, minimize?, minimizer?, moduleIds?, namedChunks?, namedModules?, noEmitOnErrors?, nodeEnv?, occurrenceOrder?, portableRecords?, providedExports?, removeAvailableModules?, removeEmptyChunks?, runtimeChunk?, sideEffects?, splitChunks?, usedExports? }
   -> Enables/Disables integrated optimizations

If the current behavior is a bug, please provide the steps to reproduce.

create webpack.config.js as example profided in documentation:

module.exports = {
  //...
  optimization: {
    mangleExports: false
  }
};

What is the expected behavior?
Webpack should not mangle exports like the documentation provides

Other relevant information:
webpack version: 5.0.0-beta-14
Node.js version: v13.12.0
Operating System: linux
Additional tools: webpack-cli@4.0.0-beta.8

@sokra
Copy link
Member

sokra commented Apr 19, 2020

The error message is coming from webpack 4. Check that you are really using webpack 5.

@JAicewizard
Copy link
Author

JAicewizard commented Apr 19, 2020

Full outputs of version and original command:

$ webpack --version
5.0.0-beta.14
[webpack-cli] Promise rejection: Error: Cannot find module '../../../../package.json'
Require stack:
- /usr/lib/node_modules/webpack-cli/lib/groups/HelpGroup.js
- /usr/lib/node_modules/webpack-cli/lib/webpack-cli.js
- /usr/lib/node_modules/webpack-cli/lib/bootstrap.js
[webpack-cli] Error: Cannot find module '../../../../package.json'
Require stack:
- /usr/lib/node_modules/webpack-cli/lib/groups/HelpGroup.js
- /usr/lib/node_modules/webpack-cli/lib/webpack-cli.js
- /usr/lib/node_modules/webpack-cli/lib/bootstrap.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at HelpGroup.outputVersion (/usr/lib/node_modules/webpack-cli/lib/groups/HelpGroup.js:43:25)
    at WebpackCLI.runVersion (/usr/lib/node_modules/webpack-cli/lib/webpack-cli.js:303:32)
    at runCLI (/usr/lib/node_modules/webpack-cli/lib/bootstrap.js:54:13)
    at Object.<anonymous> (/usr/lib/node_modules/webpack-cli/lib/bootstrap.js:117:1)
    at Module._compile (internal/modules/cjs/loader.js:1147:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
$ cat webpack.config.js
module.exports = {
	optimization: {
		mangleExports: true
	}
};
$ webpack js/main.js -o dist/main.js
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.optimization has an unknown property 'mangleExports'. These properties are valid:
   object { checkWasmTypes?, chunkIds?, concatenateModules?, flagIncludedChunks?, hashedModuleIds?, mangleWasmImports?, mergeDuplicateChunks?, minimize?, minimizer?, moduleIds?, namedChunks?, namedModules?, noEmitOnErrors?, nodeEnv?, occurrenceOrder?, portableRecords?, providedExports?, removeAvailableModules?, removeEmptyChunks?, runtimeChunk?, sideEffects?, splitChunks?, usedExports? }
   -> Enables/Disables integrated optimizations

@alexander-akait
Copy link
Member

@JAicewizard Can you create reproducible test repo?

@JAicewizard
Copy link
Author

https://github.com/JAicewizard/webpack_issue

I have installed webpack and webpack cli using:

# npm install -g webpack@5.0.0-beta.14
# npm install -g webpack-cli@4.0.0-beta.8

@alexander-akait alexander-akait transferred this issue from webpack/webpack Jul 9, 2020
@alexander-akait
Copy link
Member

Need add tests

@anshumanv
Copy link
Member

will add 👍

@VladimirMikulic
Copy link

@sokra I have the same issue.

OS: Kubuntu 20.04
Node: v12.8.2

"webpack": "^4.43.0",
"webpack-cli": "^3.3.12"

@alexander-akait
Copy link
Member

/cc @webpack/cli-team I think we fix it, somebody can add tests, or maybe we already have tests on this?

@anshumanv
Copy link
Member

adding now 👍

@anshumanv
Copy link
Member

Seems to be working fine on webpack/webpack latest beta and latest CLI, adding test

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

Successfully merging a pull request may close this issue.

5 participants