Skip to content

fix: fix assigning the readonly require on global object #29

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

Merged
merged 5 commits into from
Jan 29, 2019

Conversation

Fatme
Copy link
Contributor

@Fatme Fatme commented Jan 29, 2019

As the runtimes set the require as a readonly property to global object, it is not possible to assign to it when "strict" mode is used.
The following code throws an error in runtime TypeError: Attempted to assign to readonly property.

global.require = function () {
      throw Error();
}

Currently when tsc is used, the produced code is in strict mode and it does not work in runtime.
Currently when grunt is used, the produced code is not in strict mode.

The new behavior unifies the tsc and grunt commands and compiles the code in non strict mode.

@Fatme Fatme merged commit 275ce35 into master Jan 29, 2019
@Fatme Fatme deleted the fatme/fix-assing-to-readonly branch January 29, 2019 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants