Skip to content

Module parse failed with webpack/babel compilation #14

Description

@andynoelker

Hi, I'm trying to add this package to a pre-existing project where I'm using webpack to compile with babel. However this package is breaking on compilation with the following error:

ERROR in ./~/react-animate/src/index.jsx
Module parse failed: /path/to/project/node_modules/react-animate/src/index.jsx Line 1: Unexpected token
You may need an appropriate loader to handle this file type.
| import raf from 'raf';
| import tween from 'tween-interpolate';
| import _ from 'lodash';

I know that using babel is a requirement for this package, but I am using babel (webpack uses babel-loader). Here is the relevant part of my webpack.config.js:

entry: [
        "babel-polyfill",
        "./js/index.js"
    ],
output: {
    filename: "../project/path/bundle.js"
},
resolve: {
    extensions: ['', '.js', '.jsx'],
},
module: {
    loaders: [
        {
            loader: 'babel-loader',
            test: /\.jsx?$/,
            exclude: /(node_modules|bower_components)/,
            query: {
                   plugins: ['transform-runtime'],
                   presets: ['es2015', 'stage-0', 'react'],
            }
        }
    ]
}

I'm not sure exactly what the problem could be as I have already successfully been using other packages and writing my own ES6/ES7 code with no issues. Any idea if this is a faulty configuration on my end or something that needs to be fixed in the package itself?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions