js-dxtools / webpack-validator

Validates your webpack config with Joi
MIT License
295 stars 29 forks source link

Allow `false` as "devtool" value #128

Closed le0nik closed 8 years ago

le0nik commented 8 years ago

In webpack config it's also possible to disable sourcemaps by providing false to devtool. It's also a default value: https://github.com/webpack/webpack/blob/40aac864fd88495cd56dbec9bab522f8f34a47ea/lib/WebpackOptionsDefaulter.js#L11

It's useful, for example for this:

{
  devtool: isProd ? false : 'eval'
}

This PR adds false as a valid value for devtool.

codecov-io commented 8 years ago

Current coverage is 100% (diff: 100%)

Merging #128 into master will not change coverage

@@           master   #128   diff @@
====================================
  Files          18     18          
  Lines         151    151          
  Methods         0      0          
  Messages        0      0          
  Branches        0      0          
====================================
  Hits          151    151          
  Misses          0      0          
  Partials        0      0          

Powered by Codecov. Last update ac9fad9...c152ffc

kentcdodds commented 8 years ago

Perfect! Thanks for this!

Though I should mention that it's probably not advisable to disable source-maps in production. You'll have a hard time debugging issues that you can only reproduce in prod ;-)

le0nik commented 8 years ago

@kentcdodds thank you! Nice tip. But as it would significantly increase the file size(edit: and decrease performance in some devtool modes), what is the best practice for source-maps in production? Separate .map file?

kentcdodds commented 8 years ago

Yep! Use the source-map option 👍

le0nik commented 8 years ago

Got it. Thank you!