aminebenkeroum / toggle-switch-react-native

Toggle Switch React Native Component works on both iOS and Android
MIT License
234 stars 70 forks source link

Failed parsing on Web #37

Open mkrn opened 3 years ago

mkrn commented 3 years ago
Module parse failed: Unexpected token (52:19)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|   }
| 
>   static propTypes = {
|     isOn: PropTypes.bool.isRequired,
|     label: PropTypes.string,

babel.config.js

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
    plugins: [
      "@babel/plugin-proposal-class-properties",

      [
        "babel-plugin-inline-import",
        {
          extensions: [".svg"],
        },
      ],
    ],
  };
};
jonjamz commented 3 years ago

You probably need to transpile the module. If you're using Next, you can try this: https://www.npmjs.com/package/next-transpile-modules

dgsunesen commented 3 years ago

@mkrn I can confirm that using https://www.npmjs.com/package/next-transpile-modules in Next.js 10.1 works :)