Fix Website Build (#2526)

* Update .eslintrc to allow compile.

* Resolve .web.js extension

* Look for __DEV__ on global

Fixes ReferenceError when not in the React Native environment.

* Replace __DEV__ at compile time via babel

* Don't try to lint a website build
This commit is contained in:
Spencer Carli
2017-09-06 16:08:08 -05:00
committed by GitHub
parent 0c62701ddc
commit ba3fb1a7ee
7 changed files with 31 additions and 4 deletions

View File

@@ -25,7 +25,10 @@
"publish-web": {
"presets": ["es2015", "stage-1", "react"],
"plugins": [
"transform-flow-strip-types"
"transform-flow-strip-types",
["transform-define", {
"__DEV__": false
}]
]
}
}

View File

@@ -3,6 +3,7 @@ flow-typed
flow
node_modules
lib*
build
## Temporary
examples

View File

@@ -41,7 +41,7 @@
"react/jsx-filename-extension": [
0, { "extensions": [".js", ".jsx"] }
],
"react/sort-comp": 0,
"react/prefer-stateless-function": 0,
@@ -71,5 +71,12 @@
"flowtype": {
"onlyFilesWithFlowAnnotation": true
}
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
}
}

View File

@@ -46,6 +46,7 @@
"react-native": "*"
},
"dependencies": {
"babel-plugin-transform-define": "^1.3.0",
"clamp": "^1.0.1",
"hoist-non-react-statics": "^2.2.0",
"path-to-regexp": "^1.7.0",

View File

@@ -80,7 +80,7 @@ module.exports = {
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see:
// https://github.com/facebookincubator/create-react-app/issues/290
extensions: ['.js', '.json', '.jsx', ''],
extensions: ['.js', '.json', '.jsx', '.web.js', ''],
alias: {
'react-navigation': path.resolve(__dirname, '../../'),
},

View File

@@ -78,7 +78,7 @@ module.exports = {
// We also include JSX as a common component filename extension to support
// some tools, although we do not recommend using it, see:
// https://github.com/facebookincubator/create-react-app/issues/290
extensions: ['.js', '.json', '.jsx', ''],
extensions: ['.js', '.json', '.jsx', '.web.js', ''],
alias: {
'react-navigation': path.resolve(__dirname, '../../'),
},

View File

@@ -662,6 +662,13 @@ babel-plugin-transform-decorators@^6.24.1:
babel-template "^6.24.1"
babel-types "^6.24.1"
babel-plugin-transform-define@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-define/-/babel-plugin-transform-define-1.3.0.tgz#94c5f9459c810c738cc7c50cbd44a31829d6f319"
dependencies:
lodash "4.17.4"
traverse "0.6.6"
babel-plugin-transform-do-expressions@^6.5.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-do-expressions/-/babel-plugin-transform-do-expressions-6.22.0.tgz#28ccaf92812d949c2cd1281f690c8fdc468ae9bb"
@@ -3603,6 +3610,10 @@ lodash.templatesettings@^3.0.0:
lodash._reinterpolate "^3.0.0"
lodash.escape "^3.0.0"
lodash@4.17.4, lodash@^4.0.0, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.16.6, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.6.1:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
lodash@^3.5.0:
version "3.10.1"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
@@ -5144,6 +5155,10 @@ tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
traverse@0.6.6:
version "0.6.6"
resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.6.6.tgz#cbdf560fd7b9af632502fed40f918c157ea97137"
trim-right@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"