Compilation issue when used with Next.js
msand opened this issue · 0 comments
msand commented
I've encountered an issue while evaluating react-primitives in Next.js
{ /Users/jannegylling/IdeaProjects/seaber/with-react-native-web-app/node_modules/react-native-web/dist/exports/StyleSheet/ReactNativeStyleResolver.js:17
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
^
SyntaxError: Unexpected token {
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:646:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Module.require (internal/modules/cjs/loader.js:626:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.react-native-web/dist/exports/StyleSheet/ReactNativeStyleResolver (webpack:/external "react-native-web/dist/exports/StyleSheet/ReactNativeStyleResolver":1:0)
at __webpack_require__ (webpack:/webpack/bootstrap 4d331b16180318579799:21:0)
at Object../react-primitives/lib/injection/react-native-web.js (react-primitives/lib/injection/react-native-web.js:1:0)
at __webpack_require__ (webpack:/webpack/bootstrap 4d331b16180318579799:21:0)
at Object../react-primitives/lib/index.web.js (react-primitives/lib/index.web.js:1:0)
at __webpack_require__ (webpack:/webpack/bootstrap 4d331b16180318579799:21:0) sourceMapsApplied: true }
I think the same cause has been at issue here: styled-components/styled-components#1176
Can be fixed by requiring StyleRegistry from the react-native-web/dist/cjs folder instead