-
Notifications
You must be signed in to change notification settings - Fork 28.3k
expose webpack config #174
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.