-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
According to the standard:
Module code is always strict mode code.
React-Native enables the ES 2015 Modules Babel transformations (see here). However, modules in React Native don't have strict mode code by default.
To reproduce:
react-native init StrictModulesTest
cd StrictModulesTest
cat <<EOT > foo.js
export default function foo() {
delete Object.prototype;
}
EOT
Then insert into index.ios.js
or index.android.js
:
import foo from './foo';
foo();
and run the app.
Expected: Error Unable to delete property.
.
Actual: App is showing as normal.
Now insert "use strict";
at the beginning of foo.js
and the error shows up.
Note that babel-plugin-transform-es2015-modules-commonjs inserts the "use strict";
automatically, so in some way React-Native must disable this behavior.
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.