toggle-switch-react-native icon indicating copy to clipboard operation
toggle-switch-react-native copied to clipboard

Failed parsing on Web

Open mkrn opened this issue 4 years ago • 2 comments

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"],
        },
      ],
    ],
  };
};

mkrn avatar Dec 30 '20 14:12 mkrn

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

jonjamz avatar Jan 13 '21 20:01 jonjamz

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

dgsunesen avatar Apr 05 '21 14:04 dgsunesen