diff --git a/src/server/webpack.config.js b/src/server/webpack.config.js index 4bd1d36e2dba..6618ca6aa251 100644 --- a/src/server/webpack.config.js +++ b/src/server/webpack.config.js @@ -26,6 +26,7 @@ const config = { new webpack.optimize.OccurenceOrderPlugin(), new webpack.HotModuleReplacementPlugin(), ], + resolve: {}, module: { loaders: [ { @@ -77,6 +78,22 @@ if (fs.existsSync(customConfigPath)) { logger.info(' => Loading custom webpack plugins.'); config.plugins = config.plugins.concat(customConfig.plugins); } + + // load resolve.extensions + if (customConfig.resolve && customConfig.resolve.extensions) { + config.resolve.extensions = customConfig.resolve.extensions.slice(); + if (config.resolve.extensions.indexOf('.js') === -1) { + config.resolve.extensions.push('.js'); + } + } + + // load resolve.modulesDirectories + if (customConfig.resolve && customConfig.resolve.modulesDirectories) { + config.resolve.modulesDirectories = customConfig.resolve.modulesDirectories.slice(); + if (config.resolve.modulesDirectories.indexOf('node_modules') === -1) { + config.resolve.modulesDirectories.push('node_modules'); + } + } } export default config;