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

Update webpack.config.js #46

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/server/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const config = {
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
],
resolve: {},
module: {
loaders: [
{
Expand Down Expand Up @@ -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) {
Copy link
Member

Choose a reason for hiding this comment

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

I think it's safe to allow the whole resolve API. Not just extensions and resolve.
Adding .js and node_modules is a clever idea. I like it.

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;