Skip to content

$root not working in web env with es6 import nor require #30

Open

Description

@mutongwu
// download st.js to my local disk
var ST = require('./st.js'); 
// import ST  from './st.js';
var data = {
   a: 100,
   lists:[1,2,3]
}
var template = {
            "dt": "section_list",
            "sections": {
              "{{#each lists}}": [{
                  "{{#if $root.a > 0}}":{
                      "text": "sfsfs"
                }
              }]
            }
          }


//
ST.select(data)
	.transformWith(template)
	.root()

// output
{
	"dt": "section_list",
	"sections": [
		[{
			"{{#if $root.a > 0}}": {
				"text": "sfsfs"
			}
		}],
		[{
			"{{#if $root.a > 0}}": {
				"text": "sfsfs"
			}
		}],
		[{
			"{{#if $root.a > 0}}": {
				"text": "sfsfs"
			}
		}]
	]
}

"webpack": "^4.2.0",

Activity

  1. mutongwu commented on Dec 11, 2018

    @mutongwu
    Author

    $root was not compiled。。。。

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions