Repository navigation
expose webpack config - #174
vdanchenkov wants to merge 1 commit into
Conversation
|
I think this is a great solution. I was also thinking of using a function to decorate the suggested webpack config next wants. What do people think about:
|
| }) | ||
| } | ||
| try { | ||
| require(join(dir, 'webpack.js'))(config, hotReload) |
There was a problem hiding this comment.
how about expecting the function to return the new config instead of mutating an argument? then it's more sensible to implement via Object.assign.
// right here
config = require("...");// webpack.js in my project
module.exports = (config) => Object.assign(config, {
// my custom config
})|
I would suggest the name |
|
@giladgray I will change it to use returned value. Actually I don't like both names. webpack.config.js suggests that it exports config object. webpack.js looks like it exports webpack instance itself. Maybe webpack.next.js would be better? Actually, I think that it would be better to configure everything in the single point as suggested by @rauchg, but I don't feel like diving so deep in next.js code for now. next({
webpack: (cfg) => cfg
}) |
|
@vdanchenkov my comment on the code above (and the author's response) suggests that this file will in fact export the config object. however a code-less solution should be high priority here because the typical usage will be via NPM script. i don't want to have to create a file just to invoke |
|
I think it would be better to use a centralised config for Next called something like You could for example do something like this: // next.config.js
module.exports = {
webpack: (cfg) => cfg
} |
|
@CompuIves How should we proceed? Will you apply webpack configuration functionality to #222 before it's merged? In that case I'll close this PR in favour of yours. |
|
@vdanchenkov I added your functionality to #222! |
My attempt to implement #40. I think it's the simplest possible solution.
To customize config user have to create webpack.js in project root and export function that adjusts config as needed.