Skip to content

Commit fd3efa6

Browse files
committed
feat(compiler): add nextjs plugin factory
1 parent 1def5db commit fd3efa6

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

packages/compiler/src/plugins.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { UnpluginInstance } from 'unplugin';
2+
3+
export function createNextPlugin<O>(unplugin: UnpluginInstance<O>) {
4+
return (replexicaOptions: O, nextConfig: any) => {
5+
return {
6+
...nextConfig,
7+
webpack(config: any, options: any) {
8+
config.plugins.unshift(unplugin.webpack(replexicaOptions));
9+
10+
if (typeof nextConfig.webpack === 'function') {
11+
return nextConfig.webpack(config, options);
12+
}
13+
14+
return config;
15+
},
16+
};
17+
}
18+
}

0 commit comments

Comments
 (0)