Skip to content
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

[Next.js] Ensure disconnected JSS config plugin is run before computed plugin #1361

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { ConfigPlugin, JssConfig } from '..';

/**
* This plugin will override the "sitecoreApiHost" config prop
* for disconnected mode (using disconnected server).
* for disconnected mode, ensuring all Sitecore requests are run
* through proxy rewrites (see \src\lib\next-config\plugins\disconnected.js).
*/
class DisconnectedPlugin implements ConfigPlugin {
order = 3;
order = 2;

async exec(config: JssConfig) {
const disconnected = process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { ConfigPlugin, JssConfig } from '..';
* based on other config settings.
*/
class ComputedPlugin implements ConfigPlugin {
order = 2;
// should come after other plugins (but before fallback)
order = 10;

async exec(config: JssConfig) {
return Object.assign({}, config, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { ConfigPlugin, JssConfig } from '..';
* If neither env, nor other places had a proper value, this will ensure a fallback is set
*/
class FallbackPlugin implements ConfigPlugin {
// should always comes last
order = 99;
// should always come last
order = 100;

async exec(config: JssConfig) {
return Object.assign({}, config, {
Expand Down