Skip to content

Commit 8ab7852

Browse files
committed
Update next.config.js
1 parent 9157607 commit 8ab7852

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

www/next.config.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
// const Module = require('module')
1+
const Module = require('module')
22
const path = require('path')
33
const withCSS = require('@zeit/next-css')
44
const withImages = require('next-images')
55
const resolveFrom = require('resolve-from')
66

77
const node_modules = path.resolve(__dirname, 'node_modules')
88

9-
// const originalRequire = Module.prototype.require
9+
const originalRequire = Module.prototype.require
1010

11-
// // The following ensures that there is always only a single (and same)
12-
// // copy of React in an app at any given moment.
13-
// Module.prototype.require = function(modulePath) {
14-
// // Only redirect resolutions to non-relative and non-absolute modules
15-
// if (['/react/', '/react-dom/'].some(d => {
16-
// try {
17-
// return require.resolve(modulePath).includes(d)
18-
// } catch (err) {
19-
// return false
20-
// }
21-
// })) {
22-
// console.log(modulePath)
23-
// try {
24-
// modulePath = resolveFrom(
25-
// node_modules,
26-
// modulePath
27-
// )
28-
// console.log('New: ', modulePath)
29-
// } catch (err) {
30-
// //
31-
// }
32-
// }
11+
// The following ensures that there is always only a single (and same)
12+
// copy of React in an app at any given moment.
13+
Module.prototype.require = function(modulePath) {
14+
// Only redirect resolutions to non-relative and non-absolute modules
15+
if (['/react/', '/react-dom/'].some(d => {
16+
try {
17+
return require.resolve(modulePath).includes(d)
18+
} catch (err) {
19+
return false
20+
}
21+
})) {
22+
console.log(modulePath)
23+
try {
24+
modulePath = resolveFrom(
25+
node_modules,
26+
modulePath
27+
)
28+
console.log('New: ', modulePath)
29+
} catch (err) {
30+
//
31+
}
32+
}
3333

34-
// return originalRequire.call(this, modulePath)
35-
// }
34+
return originalRequire.call(this, modulePath)
35+
}
3636

3737
const baseConfig = {
3838
// target: 'serverless',

0 commit comments

Comments
 (0)