Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix closure compiler renaming safety. #465

Merged
merged 3 commits into from
Jan 19, 2019
Merged

Fix closure compiler renaming safety. #465

merged 3 commits into from
Jan 19, 2019

Conversation

rictic
Copy link
Contributor

@rictic rictic commented Jan 19, 2019

JSCompiler_renameProperty can't be exported from a module, it's a global. If it's exported then jscompiler doesn't treat it as special, it's just a normal function.

JSCompiler_renameProperty can't be exported from a module, it's a global. If it's exported then jscompiler doesn't treat it as special, it's just a normal function.
Copy link
Member

@dfreedm dfreedm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please update changelog

@dfreedm dfreedm merged commit 4ffa707 into master Jan 19, 2019
@dfreedm dfreedm deleted the fix-compile branch January 19, 2019 01:37
@kwiva
Copy link

kwiva commented Nov 1, 2019

Currently i'm getting this error when compiling lit element 2.2.1 with the closure compiler 20190929

node_modules/lit-element/lib/updating-element.js:127: 
Originally at:
node_modules/lit-element/src/lib/updating-element.ts:267: ERROR - [JSC_UNDEFINED_VARIABLE] variable JSCompiler_renameProperty is undeclared
            JSCompiler_renameProperty('_classProperties', this))) {
            ^^^^^^^^^^^^^^^^^^^^^^^^^

1 error(s), 0 warning(s)

@rictic
Copy link
Contributor Author

rictic commented Nov 2, 2019

What flags are you passing to closure compiler? Are you transforming lit-element using clutz?

@kwiva
Copy link

kwiva commented Nov 4, 2019

This is the list of flags for the closure compiler:

    --compilation_level ADVANCED
    --env BROWSER
    --js node_modules/google-closure-library/closure/goog/array/array.js
...
    --js node_modules/google-closure-library/third_party/closure/goog/mochikit/async/deferred.js
    --js js/demo/boot.js
    --js js/demo/MainModule.js
    --js node_modules/google-closure-library/closure/goog/dom/vendor.js
...
    --js node_modules/google-closure-library/closure/goog/style/style.js
    --js js/demo/ModuleAModule.js
    --js js/demo/bootModuleA.js
    --js node_modules/lit-element/package.json
    --js node_modules/lit-element/lit-element.js
    --js node_modules/lit-element/lib/css-tag.js
    --js node_modules/lit-element/lib/decorators.js
    --js node_modules/lit-element/lib/updating-element.js
    --js node_modules/lit-html/package.json
    --js node_modules/lit-html/lit-html.js
    --js node_modules/lit-html/lib/default-template-processor.js
    --js node_modules/lit-html/lib/directive.js
    --js node_modules/lit-html/lib/dom.js
    --js node_modules/lit-html/lib/modify-template.js
    --js node_modules/lit-html/lib/part.js
    --js node_modules/lit-html/lib/parts.js
    --js node_modules/lit-html/lib/render-options.js
    --js node_modules/lit-html/lib/render.js
    --js node_modules/lit-html/lib/shady-render.js
    --js node_modules/lit-html/lib/template-factory.js
    --js node_modules/lit-html/lib/template-instance.js
    --js node_modules/lit-html/lib/template-processor.js
    --js node_modules/lit-html/lib/template-result.js
    --js node_modules/lit-html/lib/template.js
    --js js/demo/MyElement.js
    --js js/demo/ModuleBModule.js
    --js js/demo/bootModuleB.js
    --language_in ECMASCRIPT_2017
    --language_out ECMASCRIPT_2015
    --strict_mode_input
    --assume_function_wrapper
    --rename_prefix_namespace "_"
    --dependency_mode STRICT
    --entry_point demo.boot
    --entry_point demo.bootModuleA
    --entry_point demo.bootModuleB
    --module_resolution NODE
    --chunk main:101
    --chunk module-a:7:main
    --chunk module-b:24:main
    --chunk_output_path_prefix js/generated/chunks/
    --chunk_wrapper "main:var __DEMO={};(function(_){%output%})(__DEMO);"
    --chunk_wrapper "module-a:(function(_){%output%})(__DEMO);"
    --chunk_wrapper "module-b:(function(_){%output%})(__DEMO);"
    --create_source_map %outname%.map
    --output_chunk_dependencies js/generated/chunks/chunk-dependencies.json
    --output_manifest js/generated/chunks/manifest
    --charset UTF-8
    --define "goog.DEBUG=false"
    --define "goog.json.USE_NATIVE_JSON=true"
    --define "goog.array.ASSUME_NATIVE_FUNCTIONS=true"
    --define "goog.FEATURESET_YEAR=2015"

Both lit-element and lit-html are installed using npm, and the .js files are included. Currently there is no conversion between TS and JS using clutz or tsickle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants