Skip to content

Support next 5.1 phases #2

@cyrilwanner

Description

@cyrilwanner

Next 5.1 introduced phases in the next.config.js file so specific plugins can only get applied in a specific phase. We should also add support for it.

I'm not sure about the api yet, maybe something like this:

// next.config.js

module.exports = withPlugins([

  // only add next-offline on production build & production server
  [offline, {
    /* offline config */
  }, [PHASE_PRODUCTION_BUILD, PHASE_PRODUCTION_SERVER]],

  // add next-typescript to all phases (default if none is specified)
  [typescript, {
    /* typescript config */
  }],

  // add next-sass in every phase except on the development server (when first argument is '!' -> blacklisting phases)
  [sass, {
    /* sass config */
  }, ['!', PHASE_DEVELOPMENT_SERVER]],

], nextConfiguration);

Please comment if you have inputs or another idea :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions