Closed TLevesque closed 5 years ago
Hi @TLevesque
You are right that the proposed solution can't be copied 1:1 when using this plugin because it has to be the function you export from your config file.
But next-compose-plugins
has a feature called Optional Plugins which solves the same problem (only including a dependency in a specific phase) and, in my eyes, does that even cleaner.
So your config file would look like this when using next-compose-plugins:
const { withPlugins, optional } = require('next-compose-plugins');
const { PHASE_PRODUCTION_SERVER } = require('next-server/constants');
module.exports = withPlugins([
[optional(() => require('@zeit/next-sass')), ['!', PHASE_PRODUCTION_SERVER]],
[optional(() => require('next-images')), ['!', PHASE_PRODUCTION_SERVER]],
]);
I hope that this solves your problem :)
Ok, perfect! Thank you
I couldn't get this to work @cyrilwanner. I think because it still requires next-compose-plugins
which is not bundled by the builder.
Hi, just want to notify a bug with next-sass loader when using the required next.config.js pattern suggested by Zeit team to fix 'now__launder' bug, described there: https://github.com/zeit/next.js/issues/5750
Here is the minimalist github repo to reproduce the problem https://github.com/TLevesque/koa-now It requires to uncomment the lines 12 to 22 in next.config.js and comment the lines 24 to 32 to trigger it.
Here is the error message :