-->

How to use polymer-redux with polymer-build?

2019-04-13 16:25发布

问题:

I've currently started a new project based on Polymer Custom Build. I've modified the project in order to add usage of polymer-redux. Since then, when trying to build a bundled project using the command gulp build, I have the following problem

[unknown-polymer-behavior] - Unable to resolve behavior ReduxBehavior. Did you import it? Is it annotated with @polymerBehavior?

Declaring the ReduxBehavior is done using ReduxBehavior = PolymerRedux(store); which is not very usual.

Anybody succeeded to make both of polymer-build and polymer-redux work together ?

回答1:

You can check the sample repo for Polymer 2 with Redux Application.

https://github.com/kumarargutech/polymer-redux

I hope it's helpful to you!



回答2:

You can check out this Polycast edition.

Here is the code

You can also check the Simpla repo

Basically you create a polymer-redux-store-html:

<html>
    <head>
        <link rel="import" href="../bower_components/polymer-redux/polymer-redux.html">
        <script>
            var ReduxBehavior = new PolymerRedux(THG.store);
        </script>
    </head>
    <body>
    </body>
</html>

and include it in any element where you need the ReduxBehavior