-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support webpack configs that export a function
Webpack 2 supports webpack configuration files that export a function (see https://webpack.github.io/docs/roadmap.html). This commit adds support for this by testing if the `require`ed config is a function, and if so, executing it.
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
var path = require('path') | ||
var pluginsTest = require('webpack-resolver-plugin-test') | ||
|
||
module.exports = function() { | ||
return { | ||
resolve: { | ||
alias: { | ||
'foo': path.join(__dirname, 'some', 'goofy', 'path', 'foo.js'), | ||
'some-alias': path.join(__dirname, 'some'), | ||
}, | ||
modulesDirectories: ['node_modules', 'bower_components'], | ||
root: path.join(__dirname, 'src'), | ||
fallback: path.join(__dirname, 'fallback'), | ||
}, | ||
|
||
externals: [ | ||
{ 'jquery': 'jQuery' }, | ||
'bootstrap', | ||
function (context, request, callback) { | ||
if (request === 'underscore') { | ||
return callback(null, 'underscore') | ||
} | ||
callback() | ||
}, | ||
], | ||
|
||
plugins: [ | ||
new pluginsTest.ResolverPlugin([ | ||
new pluginsTest.SimpleResolver( | ||
path.join(__dirname, 'some', 'bar', 'bar.js'), | ||
path.join(__dirname, 'some', 'bar') | ||
), | ||
]), | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters