Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes web build for expo #205

Open
bjornarhagen opened this issue Aug 6, 2020 · 9 comments
Open

Crashes web build for expo #205

bjornarhagen opened this issue Aug 6, 2020 · 9 comments

Comments

@bjornarhagen
Copy link

Expo cannot build web version when using this module.
This is the error I get:

.../node_modules/@ptomasroos/react-native-multi-slider/MultiSlider.js 18:22
Module parse failed: Unexpected token (18:22)
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
| 
| export default class MultiSlider extends React.Component {
>   static defaultProps = {
|     values: [0],
|     onValuesChangeStart: () => {},
@bjornarhagen
Copy link
Author

For some weird reason, if I download the ZIP of the same release version and put it in my project folder it works. But when I use the node_modules version, it doesn't work.
So this works great as a temporary workaround, but should probably still be fixed.

@ptomasroos
Copy link
Owner

Ah thanks!

I will make sure to do a release then if its sorted out in the latest version of the code base?

@ptomasroos
Copy link
Owner

This seems to be similar, are you sure you're not missing on a babel plugin?
styleguidist/react-styleguidist#1513

@bjornarhagen
Copy link
Author

That does indeed seem like the same issue.
I installed metro-react-native-babel-preset and replaced babel-preset-expo with it in babel.config.js, but the error prevails. I also tried to add @babel/plugin-proposal-class-properties, but it still fails.

@nsbingham
Copy link

I'm running into the same issue. I'm using expo 39.0.2. Using the downloaded ZIP works in the expo web build, but throws the error below when trying to load on an Android emulator.

Unable to resolve "../../components/react-native-multi-slider/MultiSlider" from "src\screens\find-wizard-screens\find-wizard-prices.js"

@nsbingham
Copy link

@bjornarhagen I was able to get the NPM package running the expo web build by following the steps in this similar issue - akveo/react-native-ui-kitten#996 (comment).

My webpack.config.js ended up looking like this:

const createExpoWebpackConfigAsync = require("@expo/webpack-config");

module.exports = async function (env, argv) {
  const config = await createExpoWebpackConfigAsync(
    {
      ...env,
      babel: {
        dangerouslyAddModulePathsToTranspile: [
          "@ptomasroos/react-native-multi-slider",
        ],
      },
    },
    argv
  );
  return config;
};

@brunokiafuka
Copy link

@bjornarhagen I was able to get the NPM package running the expo web build by following the steps in this similar issue - akveo/react-native-ui-kitten#996 (comment).

My webpack.config.js ended up looking like this:

const createExpoWebpackConfigAsync = require("@expo/webpack-config");

module.exports = async function (env, argv) {
  const config = await createExpoWebpackConfigAsync(
    {
      ...env,
      babel: {
        dangerouslyAddModulePathsToTranspile: [
          "@ptomasroos/react-native-multi-slider",
        ],
      },
    },
    argv
  );
  return config;
};

This worked for me 😅

@fabianschwarzfritz
Copy link

I do have the exact same issue but the webpack.config changes did not work for me.

Is there a workaround for this issue?

@bananemo
Copy link

bananemo commented Dec 13, 2022

@bjornarhagen I was able to get the NPM package running the expo web build by following the steps in this similar issue - akveo/react-native-ui-kitten#996 (comment).

My webpack.config.js ended up looking like this:

const createExpoWebpackConfigAsync = require("@expo/webpack-config");

module.exports = async function (env, argv) {
  const config = await createExpoWebpackConfigAsync(
    {
      ...env,
      babel: {
        dangerouslyAddModulePathsToTranspile: [
          "@ptomasroos/react-native-multi-slider",
        ],
      },
    },
    argv
  );
  return config;
};

This works for me too! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants