Skip to content

Commit 09253eb

Browse files
committed
Replace eval with Function
1 parent b32ef05 commit 09253eb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib/twConfigParser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import flattenColorPalette from 'tailwindcss/lib/util/flattenColorPalette'
22
import resolveConfig from 'tailwindcss/resolveConfig'
33

44
export default (configStr) => {
5-
const config = eval(configStr)
6-
return resolveConfig(config)
5+
configStr = configStr.replace(/module.exports = /, '')
6+
/* eslint-disable-next-line */
7+
return resolveConfig(Function('return (' + configStr + ')')())
78
}
89

910
export const transformThemeForCanvas = ({ theme }) => {

0 commit comments

Comments
 (0)