From ab9c788c2c8556bb7f76a7db77f354d7227bb102 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Tue, 15 Aug 2017 08:08:53 -0700 Subject: [PATCH] RN babel preset: add import() syntax Summary: Allows us to parse the `import()` syntax. For now it's not transformed, so it would crash at runtime (or at minification with UglifyJS). However I want to release this under a new major version, so this wouldn't be allowed in OSS right away. Also we bump to version 3.0.0 before release. D5443966 possibly introduced breaking changes, so it needs a major bump. Reviewed By: cpojer Differential Revision: D5630084 fbshipit-source-id: b271bbb8577ba7184e975f996ec415a915e869d9 --- babel-preset/configs/main.js | 1 + babel-preset/package.json | 3 ++- babel-preset/plugins.js | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/babel-preset/configs/main.js b/babel-preset/configs/main.js index 15b3d2b13..fc3186e4d 100644 --- a/babel-preset/configs/main.js +++ b/babel-preset/configs/main.js @@ -21,6 +21,7 @@ const getPreset = (src, options) => { plugins.push( 'syntax-class-properties', + 'syntax-dynamic-import', 'syntax-trailing-function-commas', 'transform-class-properties', 'transform-es2015-block-scoping', diff --git a/babel-preset/package.json b/babel-preset/package.json index f70959ab2..c4d4b0f22 100644 --- a/babel-preset/package.json +++ b/babel-preset/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-react-native", - "version": "2.0.0", + "version": "3.0.0", "description": "Babel preset for React Native applications", "main": "index.js", "repository": "https://github.com/facebook/react-native/tree/master/babel-preset", @@ -19,6 +19,7 @@ "babel-plugin-react-transform": "2.0.2", "babel-plugin-syntax-async-functions": "^6.5.0", "babel-plugin-syntax-class-properties": "^6.5.0", + "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-plugin-syntax-flow": "^6.5.0", "babel-plugin-syntax-jsx": "^6.5.0", "babel-plugin-syntax-trailing-function-commas": "^6.5.0", diff --git a/babel-preset/plugins.js b/babel-preset/plugins.js index 07e3ec3a6..d629bd92c 100644 --- a/babel-preset/plugins.js +++ b/babel-preset/plugins.js @@ -12,6 +12,7 @@ module.exports = { 'babel-plugin-react-transform': require('babel-plugin-react-transform'), 'babel-plugin-syntax-async-functions': require('babel-plugin-syntax-async-functions'), 'babel-plugin-syntax-class-properties': require('babel-plugin-syntax-class-properties'), + 'babel-plugin-syntax-dynamic-import': require('babel-plugin-syntax-dynamic-import'), 'babel-plugin-syntax-trailing-function-commas': require('babel-plugin-syntax-trailing-function-commas'), 'babel-plugin-transform-class-properties': require('babel-plugin-transform-class-properties'), 'babel-plugin-transform-es2015-function-name': require('babel-plugin-transform-es2015-function-name'),