Skip to content

Commit

Permalink
Fix resolve block to prefer custom extensions over defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
zcei committed Jul 19, 2017
1 parent 2d4cd9c commit 9a38a52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/core/lib/blockUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const webpackMerge = require('webpack-merge')

module.exports = {
merge,
mergeWithStrategy,
addLoader,
addPlugin
}
Expand All @@ -11,6 +12,10 @@ function merge (configSnippet) {
return prevConfig => webpackMerge.smart(prevConfig, configSnippet)
}

function mergeWithStrategy (configSnippet, strategy) {
return prevConfig => webpackMerge.smartStrategy(strategy)(prevConfig, configSnippet)
}

function addLoader (loaderDef) {
const cleanedLoaderDef = _.omitBy(loaderDef, _.isUndefined)
return prevConfig => webpackMerge.smart(prevConfig, {
Expand Down
5 changes: 3 additions & 2 deletions packages/webpack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ function performance (performanceBudget) {
* @see https://webpack.js.org/configuration/resolve/
*/
function resolve (config) {
return (context, util) => util.merge({
const strategy = { 'resolve.extensions': 'prepend' }
return (context, util) => util.mergeWithStrategy({
resolve: config
})
}, strategy)
}

/**
Expand Down

0 comments on commit 9a38a52

Please sign in to comment.