Skip to content

Use react-magic-move with webpack #7

@hugooliveirad

Description

@hugooliveirad

Hi! I want to use react-magic-move in my app. The catch is that I'm compiling everything with webpack and using the exclude option to prevent compiling every dependency.

My webpack.config.js looks like this:

module: {
    loaders: [
      { test: /\.js$/, loaders: ['react-hot', 'babel?experimental'], exclude: /node_modules/ }
    ]
}

When I try to build a file with require('react-magic-move') I get this error:

ERROR in ./~/react-magic-move/modules/components/MagicMove.js
Module parse failed: /Users/hugo.bessa/Sites/copag-cartas/node_modules/react-magic-move/modules/components/MagicMove.js Line 8: Unexpected token (
You may need an appropriate loader to handle this file type.
|   displayName: 'MagicMoveClones',
|
|   childrenWithPositions () {
|     var children = [];
|     React.Children.forEach(this.props.children, (child) => {
 @ ./~/react-magic-move/modules/index.js 1:17-50

As I'm excluding my dependencies from the build step, and react-magic-move is exporting an ES6 module, the build step is failing.

Can react-magic-move export an ES5 CommonJS bundle or should I change my webpack configs?

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