khevamann / rn-responsive-styles

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

Cannot use import statement outside a module #12

Closed JinbeiStudio closed 1 year ago

JinbeiStudio commented 1 year 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 1 year 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 1 year ago

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