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

Fix issue when extending webpack config #1468

Merged
merged 1 commit into from
Jul 17, 2017

Conversation

fvgs
Copy link
Contributor

@fvgs fvgs commented Jul 14, 2017

Issue: #1467

What I did

Fix bug leading to property access on undefined value

How to test

Run storybook after extending the webpack config with the following:

webpack.config.js

const webpack = require('webpack');

module.exports = {
  plugins: [
    new webpack.ProvidePlugin({
      $: 'jquery',
    }),
  ],
};

(Assumes jquery is installed)

@codecov
Copy link

codecov bot commented Jul 14, 2017

Codecov Report

Merging #1468 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1468   +/-   ##
=======================================
  Coverage   14.54%   14.54%           
=======================================
  Files         202      202           
  Lines        4649     4649           
  Branches      499      504    +5     
=======================================
  Hits          676      676           
+ Misses       3548     3535   -13     
- Partials      425      438   +13
Impacted Files Coverage Δ
app/react/src/server/config.js 0% <ø> (ø) ⬆️
.../ui/src/modules/ui/components/left_panel/header.js 28.57% <0%> (ø) ⬆️
addons/info/src/components/Props.js 0% <0%> (ø) ⬆️
lib/ui/src/modules/api/actions/api.js 49.42% <0%> (ø) ⬆️
app/react-native/src/bin/storybook-build.js 0% <0%> (ø) ⬆️
app/react/src/client/preview/element_check.js 41.17% <0%> (ø) ⬆️
app/react/src/demo/Welcome.js 0% <0%> (ø) ⬆️
app/react-native/src/preview/story_kind.js 0% <0%> (ø) ⬆️
lib/ui/src/libs/key_events.js 23.25% <0%> (ø) ⬆️
addons/knobs/src/KnobStore.js 6.81% <0%> (ø) ⬆️
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2e1197...6985e2c. Read the comment docs.

rules: [...config.module.rules, ...(customConfig.module.rules || [])],
rules: [
...config.module.rules,
...((customConfig.module && customConfig.module.rules) || []),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fvgs if customConfig.module is falsy, isn't it also going to break on L75 above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shilman I don't believe so. customConfig.module should be either an object or undefined. In the case of an object, the application of the object spread operator is fine. In the case of undefined, it's also fine. See Null/Undefined Are Ignored.

Testing with npm link, I have not observed additional issues.

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

Successfully merging this pull request may close these issues.

2 participants