Skip to content

Commit 5e28870

Browse files
authored
fix(server): fix usage when compiled using webpack (#185)
Closes #181
1 parent ad9350c commit 5e28870

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/server/src/util.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ export const smartRequire = modulePath => {
55
clearModuleCache(modulePath)
66
}
77

8-
// eslint-disable-next-line global-require, import/no-dynamic-require
9-
return require(modulePath)
8+
// Use eval to prevent Webpack from compiling it
9+
// when the server-side code is compiled with Webpack
10+
// eslint-disable-next-line no-eval
11+
return eval('module.require')(modulePath)
1012
}
1113

1214
export const joinURLPath = (...paths) => {

0 commit comments

Comments
 (0)