How to use polymer-redux with polymer-build?

2019-04-13 16:39发布

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 ?

2条回答
一纸荒年 Trace。
2楼-- · 2019-04-13 17:08

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

查看更多
Viruses.
3楼-- · 2019-04-13 17:19

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!

查看更多
登录 后发表回答