File tree 4 files changed +1015
-21
lines changed
4 files changed +1015
-21
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,22 @@ module.exports = withBundleAnalyzer({
12
12
basePath : '' ,
13
13
reactStrictMode : true ,
14
14
swcMinify : true ,
15
+ webpack : ( config , { dev, isServer } ) => {
16
+ config . module . rules . push ( {
17
+ test : / \. s v g $ / ,
18
+ use : [ '@svgr/webpack' ] ,
19
+ } )
20
+
21
+ if ( ! dev && ! isServer ) {
22
+ // Replace React with Preact only in client production build
23
+ Object . assign ( config . resolve . alias , {
24
+ 'react/jsx-runtime.js' : 'preact/compat/jsx-runtime' ,
25
+ react : 'preact/compat' ,
26
+ 'react-dom/test-utils' : 'preact/test-utils' ,
27
+ 'react-dom' : 'preact/compat' ,
28
+ } )
29
+ }
30
+
31
+ return config
32
+ } ,
15
33
} ) ;
Original file line number Diff line number Diff line change 12
12
"start" : " next start" ,
13
13
"lint" : " next lint" ,
14
14
"test" : " jest" ,
15
+ "analyze" : " cross-env ANALYZE=true next build" ,
15
16
"format" : " prettier \" ./**/*.{ts,tsx}\" --write" ,
16
17
"check" : " eslint --ext .ts,.tsx/ --fix" ,
17
18
"generate" : " yarn plop --plopfile ./generators/plopfile.js" ,
21
22
"axios" : " ^0.27.2" ,
22
23
"next" : " ^12.2.0" ,
23
24
"next-seo" : " ^5.4.0" ,
25
+ "preact" : " ^10.9.0" ,
24
26
"react" : " ^18.2.0" ,
25
27
"react-dom" : " ^18.2.0"
26
28
},
27
29
"devDependencies" : {
28
30
"@next/bundle-analyzer" : " ^12.2.0" ,
31
+ "@svgr/webpack" : " ^6.2.1" ,
29
32
"@testing-library/dom" : " ^8.16.0" ,
30
33
"@testing-library/jest-dom" : " ^5.16.4" ,
31
34
"@testing-library/react" : " ^13.3.0" ,
35
38
"@typescript-eslint/eslint-plugin" : " ^5.30.5" ,
36
39
"@typescript-eslint/parser" : " ^5.30.5" ,
37
40
"autoprefixer" : " ^10.4.7" ,
41
+ "cross-env" : " ^7.0.3" ,
38
42
"cssnano" : " ^5.1.12" ,
39
43
"eslint" : " ^8.19.0" ,
40
44
"eslint-config-next" : " ^12.2.2" ,
You can’t perform that action at this time.
0 commit comments