forked from reactjs/es.react.dev
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
Latest commit
70 lines (65 loc) · 1.89 KB
/
Copy pathnext.config.js
File metadata and controls
70 lines (65 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
/**
* @type {import('next').NextConfig}
**/
constnextConfig={
pageExtensions: ['jsx','js','ts','tsx','mdx','md'],
reactStrictMode: true,
experimental: {
plugins: true,
scrollRestoration: true,
legacyBrowsers: false,
browsersListForSwc: true,
},
env: {
SANDPACK_BARE_COMPONENTS: process.env.SANDPACK_BARE_COMPONENTS,
},
webpack: (config,{dev, isServer, ...options})=>{
if(process.env.ANALYZE){
const{BundleAnalyzerPlugin}=require('webpack-bundle-analyzer');
config.plugins.push(
newBundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: options.isServer
? '../analyze/server.html'
: './analyze/client.html',
})
);
}
// Don't bundle the shim unnecessarily.
config.resolve.alias['use-sync-external-store/shim']='react';
const{IgnorePlugin, NormalModuleReplacementPlugin}=require('webpack');
config.plugins.push(
newNormalModuleReplacementPlugin(
/^@stitches\/core$/,
require.resolve('./src/utils/emptyShim.js')
),
newNormalModuleReplacementPlugin(
/^raf$/,
require.resolve('./src/utils/rafShim.js')
),
newNormalModuleReplacementPlugin(
/^process$/,
require.resolve('./src/utils/processShim.js')
),
newIgnorePlugin({
checkResource(resource,context){
if(
/\/eslint\/lib\/rules$/.test(context)&&
/\.\/[\w-]+(\.js)?$/.test(resource)
){
// Skips imports of built-in rules that ESLint
// tries to carry into the bundle by default.
// We only want the engine and the React rules.
returntrue;
}
returnfalse;
},
})
);
returnconfig;
},
};
module.exports=nextConfig;