khevamann / rn-responsive-styles

Responsive styles for react-native and react-native-web
MIT License
40 stars 3 forks source link

Cannot use import statement outside a module #12

Closed JinbeiStudio closed 2 years ago

JinbeiStudio commented 2 years ago

Hello,

I have this error on my monorepo next js / expo project using next on the web and your package. Cannot use import statement outside a module

Would you know how to fix this ?

Object.<anonymous>
file:///var/www/node_modules/rn-responsive-styles/lib/index.js (4:24)
Module._compile
node:internal/modules/cjs/loader (1103:14)

Thank you

JinbeiStudio commented 2 years ago

I managed to fix the issue by using next-transpiles-modules on your package in next.config.js :

const withTM = require('next-transpile-modules')([
    'rn-responsive-styles',
]);
khevamann commented 2 years ago

@JinbeiStudio Yes that would be the correct way to handle this package with a nexpo monorepo