Skip to content

Commit

Permalink
switch to using export default for loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
lobsterkatie committed Aug 4, 2022
1 parent 985fb0d commit cd3e26b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions packages/nextjs/src/config/loaders/dataFetchersLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function wrapFunctions(userCode: string, templateCode: string, filepath: string)
/**
* Wrap `getStaticPaths`, `getStaticProps`, and `getServerSideProps` (if they exist) in the given page code
*/
function wrapDataFetchersLoader(this: LoaderThis<LoaderOptions>, userCode: string): string {
export default function wrapDataFetchersLoader(this: LoaderThis<LoaderOptions>, userCode: string): string {
// We know one or the other will be defined, depending on the version of webpack being used
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const { projectDir } = this.getOptions ? this.getOptions() : this.query!;
Expand Down Expand Up @@ -113,5 +113,3 @@ function wrapDataFetchersLoader(this: LoaderThis<LoaderOptions>, userCode: strin
);
return `${modifiedUserCode}\n${injectedCode}`;
}

export { wrapDataFetchersLoader as default };
4 changes: 1 addition & 3 deletions packages/nextjs/src/config/loaders/prefixLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type LoaderOptions = {
/**
* Inject templated code into the beginning of a module.
*/
function prefixLoader(this: LoaderThis<LoaderOptions>, userCode: string): string {
export default function prefixLoader(this: LoaderThis<LoaderOptions>, userCode: string): string {
// We know one or the other will be defined, depending on the version of webpack being used
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const { distDir } = this.getOptions ? this.getOptions() : this.query!;
Expand All @@ -25,5 +25,3 @@ function prefixLoader(this: LoaderThis<LoaderOptions>, userCode: string): string

return `${templateCode}\n${userCode}`;
}

export { prefixLoader as default };

0 comments on commit cd3e26b

Please sign in to comment.