Skip to content

Commit ba3fb1a

Browse files
authored
Fix Website Build (react-navigation#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
1 parent 0c62701 commit ba3fb1a

File tree

7 files changed

+31
-4
lines changed

7 files changed

+31
-4
lines changed

.babelrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
"publish-web": {
2626
"presets": ["es2015", "stage-1", "react"],
2727
"plugins": [
28-
"transform-flow-strip-types"
28+
"transform-flow-strip-types",
29+
["transform-define", {
30+
"__DEV__": false
31+
}]
2932
]
3033
}
3134
}

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ flow-typed
33
flow
44
node_modules
55
lib*
6+
build
67

78
## Temporary
89
examples

.eslintrc

+8-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"react/jsx-filename-extension": [
4242
0, { "extensions": [".js", ".jsx"] }
4343
],
44-
44+
4545
"react/sort-comp": 0,
4646
"react/prefer-stateless-function": 0,
4747

@@ -71,5 +71,12 @@
7171
"flowtype": {
7272
"onlyFilesWithFlowAnnotation": true
7373
}
74+
},
75+
"parserOptions": {
76+
"ecmaVersion": 6,
77+
"sourceType": "module",
78+
"ecmaFeatures": {
79+
"modules": true
80+
}
7481
}
7582
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"react-native": "*"
4747
},
4848
"dependencies": {
49+
"babel-plugin-transform-define": "^1.3.0",
4950
"clamp": "^1.0.1",
5051
"hoist-non-react-statics": "^2.2.0",
5152
"path-to-regexp": "^1.7.0",

website/config/webpack.config.dev.js

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

website/config/webpack.config.prod.js

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

yarn.lock

+15
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,13 @@ babel-plugin-transform-decorators@^6.24.1:
662662
babel-template "^6.24.1"
663663
babel-types "^6.24.1"
664664

665+
babel-plugin-transform-define@^1.3.0:
666+
version "1.3.0"
667+
resolved "https://registry.yarnpkg.com/babel-plugin-transform-define/-/babel-plugin-transform-define-1.3.0.tgz#94c5f9459c810c738cc7c50cbd44a31829d6f319"
668+
dependencies:
669+
lodash "4.17.4"
670+
traverse "0.6.6"
671+
665672
babel-plugin-transform-do-expressions@^6.5.0:
666673
version "6.22.0"
667674
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:
36033610
lodash._reinterpolate "^3.0.0"
36043611
lodash.escape "^3.0.0"
36053612

3613+
[email protected], 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:
3614+
version "4.17.4"
3615+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
3616+
36063617
lodash@^3.5.0:
36073618
version "3.10.1"
36083619
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
@@ -5144,6 +5155,10 @@ tr46@~0.0.3:
51445155
version "0.0.3"
51455156
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
51465157

5158+
5159+
version "0.6.6"
5160+
resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.6.6.tgz#cbdf560fd7b9af632502fed40f918c157ea97137"
5161+
51475162
trim-right@^1.0.1:
51485163
version "1.0.1"
51495164
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"

0 commit comments

Comments
 (0)