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

Example from documentation fails: externals with array as property value #8041

Closed
RubenVerborgh opened this issue Sep 16, 2018 · 2 comments · Fixed by #8043
Closed

Example from documentation fails: externals with array as property value #8041

RubenVerborgh opened this issue Sep 16, 2018 · 2 comments · Fixed by #8043

Comments

@RubenVerborgh
Copy link
Contributor

Bug report

What is the current behavior?

Having an array as property value for the externals object, despite being documented at https://webpack.js.org/configuration/externals/#array, fails with Invalid configuration object.

module.exports = {
  //...
  externals: {
    subtract: ['./math', 'subtract']
  }
};

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

npm install --save-dev webpack@4.19.0 webpack-cli@3.1.0
mkdir src
touch src/index.js
echo "
module.exports = {
  mode: 'production',
  externals: {
    subtract: ['./math', 'subtract']
  }
};" > webpack.config.js
node_modules/.bin/webpack

What is the expected behavior?

Webpack respects the configuration and looks up the subtract submodule of math.

Other relevant information:
webpack version: 4.19.0
Node.js version: v10.0.9
Operating System: macOS 10.13.6
Additional tools: none

@sokra
Copy link
Member

sokra commented Sep 17, 2018

Seems like the schema is to strict here.

Please send a PR to allow arrays of strings here too:

"additionalProperties": {
"description": "The dependency used for the external",
"anyOf": [
{
"type": "string"
},
{
"type": "object"
},
{
"type": "boolean"
}
]
},

@RubenVerborgh
Copy link
Contributor Author

@sokra Thanks, PR in #8043.

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

Successfully merging a pull request may close this issue.

3 participants