Skip to content

v0.4.0 doesn't work with webpack 2 #50

Closed
@daltones

Description

@daltones

scroll-behavior v0.9.0 has the entry "module": "es/index.js" in package.json, which is great for webpack 2. But react-router-scroll v0.4.0 doesn't.

So now, here with webpack v2.1.0-beta.25, I'm getting this error:
Uncaught (in promise) TypeError: _scrollBehavior2.default is not a constructor

That's because webpack 2 resolves scroll-behavior with ES6 imports by its own way and react-router-scroll with common JS require's tries to use babel's logic.

So this import in src/ScrollBehaviorContext.js:

import ScrollBehavior from 'scroll-behavior';

needs to be rolled back to:

import ScrollBehavior from 'scroll-behavior/lib/ScrollBehavior';

Or, as a better solution, to offer also the es/ modules like scroll-behavior does.

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