mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-08 20:35:21 +00:00
[fix] CommonJS exports can be imported without 'default'
Make sure all the CommonJS modules can be required as normal, rather than needing to be suffixed with `.default` due to being compiled from ES modules.
This commit is contained in:
+6
-3
@@ -4,8 +4,9 @@
|
|||||||
"name": "react-native-web-monorepo",
|
"name": "react-native-web-monorepo",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "del ./packages/*/dist",
|
"clean": "del ./packages/*/dist",
|
||||||
"compile": "yarn clean && cd packages/react-native-web && babel src --out-dir dist --ignore \"**/__tests__\"",
|
"compile": "npm-run-all clean -p \"compile:* -- {@}\" --",
|
||||||
"compile:commonjs": "cd packages/react-native-web && MODULES=commonjs babel src --out-dir dist/cjs --ignore \"**/__tests__\"",
|
"compile:commonjs": "cd packages/react-native-web && BABEL_ENV=commonjs babel src --out-dir dist/cjs --ignore \"**/__tests__\"",
|
||||||
|
"compile:es": "cd packages/react-native-web && babel src --out-dir dist --ignore \"**/__tests__\"",
|
||||||
"benchmarks": "cd packages/benchmarks && yarn build",
|
"benchmarks": "cd packages/benchmarks && yarn build",
|
||||||
"benchmarks:release": "cd packages/benchmarks && yarn release",
|
"benchmarks:release": "cd packages/benchmarks && yarn release",
|
||||||
"website": "cd website && yarn start",
|
"website": "cd website && yarn start",
|
||||||
@@ -13,7 +14,7 @@
|
|||||||
"flow": "flow",
|
"flow": "flow",
|
||||||
"fmt": "find packages scripts types website -name '*.js' | grep -v -E '(node_modules|dist|vendor)' | xargs yarn fmt:cmd",
|
"fmt": "find packages scripts types website -name '*.js' | grep -v -E '(node_modules|dist|vendor)' | xargs yarn fmt:cmd",
|
||||||
"fmt:cmd": "prettier --write",
|
"fmt:cmd": "prettier --write",
|
||||||
"jest": "MODULES=commonjs jest --config ./scripts/jest/config.js",
|
"jest": "BABEL_ENV=commonjs jest --config ./scripts/jest/config.js",
|
||||||
"lint": "yarn lint:check --fix",
|
"lint": "yarn lint:check --fix",
|
||||||
"lint:check": "eslint packages scripts website",
|
"lint:check": "eslint packages scripts website",
|
||||||
"precommit": "lint-staged",
|
"precommit": "lint-staged",
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
"babel-core": "^6.26.0",
|
"babel-core": "^6.26.0",
|
||||||
"babel-eslint": "^8.2.3",
|
"babel-eslint": "^8.2.3",
|
||||||
"babel-loader": "^7.1.2",
|
"babel-loader": "^7.1.2",
|
||||||
|
"babel-plugin-add-module-exports": "^0.2.1",
|
||||||
"babel-plugin-transform-class-properties": "^6.24.1",
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
||||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||||
"babel-plugin-transform-react-remove-prop-types": "^0.4.10",
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.10",
|
||||||
@@ -49,6 +51,7 @@
|
|||||||
"jest": "^22.4.3",
|
"jest": "^22.4.3",
|
||||||
"jest-canvas-mock": "^1.0.2",
|
"jest-canvas-mock": "^1.0.2",
|
||||||
"lint-staged": "^7.1.0",
|
"lint-staged": "^7.1.0",
|
||||||
|
"npm-run-all": "^4.1.3",
|
||||||
"prettier": "^1.12.1",
|
"prettier": "^1.12.1",
|
||||||
"react": "^16.3.2",
|
"react": "^16.3.2",
|
||||||
"react-art": "^16.3.2",
|
"react-art": "^16.3.2",
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
module.exports = {
|
const createConfig = ({ modules }) => ({
|
||||||
presets: [
|
presets: [
|
||||||
[
|
[
|
||||||
'babel-preset-env',
|
'babel-preset-env',
|
||||||
{
|
{
|
||||||
loose: true,
|
loose: true,
|
||||||
modules: process.env.MODULES || false,
|
modules,
|
||||||
exclude: ['transform-es2015-typeof-symbol'],
|
exclude: ['transform-es2015-typeof-symbol'],
|
||||||
targets: {
|
targets: {
|
||||||
browsers: [
|
browsers: [
|
||||||
@@ -31,5 +31,10 @@ module.exports = {
|
|||||||
['babel-plugin-transform-class-properties', { loose: true }],
|
['babel-plugin-transform-class-properties', { loose: true }],
|
||||||
['babel-plugin-transform-object-rest-spread', { useBuiltIns: true }],
|
['babel-plugin-transform-object-rest-spread', { useBuiltIns: true }],
|
||||||
['babel-plugin-transform-react-remove-prop-types', { mode: 'wrap' }]
|
['babel-plugin-transform-react-remove-prop-types', { mode: 'wrap' }]
|
||||||
]
|
].concat(modules ? ['babel-plugin-add-module-exports'] : [])
|
||||||
};
|
});
|
||||||
|
|
||||||
|
module.exports =
|
||||||
|
process.env.BABEL_ENV === 'commonjs'
|
||||||
|
? createConfig({ modules: 'commonjs' })
|
||||||
|
: createConfig({ modules: false });
|
||||||
|
|||||||
@@ -1133,6 +1133,10 @@ babel-messages@^6.23.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
babel-runtime "^6.22.0"
|
babel-runtime "^6.22.0"
|
||||||
|
|
||||||
|
babel-plugin-add-module-exports@^0.2.1:
|
||||||
|
version "0.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-0.2.1.tgz#9ae9a1f4a8dc67f0cdec4f4aeda1e43a5ff65e25"
|
||||||
|
|
||||||
babel-plugin-check-es2015-constants@^6.22.0, babel-plugin-check-es2015-constants@^6.5.0:
|
babel-plugin-check-es2015-constants@^6.22.0, babel-plugin-check-es2015-constants@^6.5.0:
|
||||||
version "6.22.0"
|
version "6.22.0"
|
||||||
resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a"
|
resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a"
|
||||||
@@ -2843,7 +2847,7 @@ cross-spawn@5.1.0, cross-spawn@^5.0.1, cross-spawn@^5.1.0:
|
|||||||
shebang-command "^1.2.0"
|
shebang-command "^1.2.0"
|
||||||
which "^1.2.9"
|
which "^1.2.9"
|
||||||
|
|
||||||
cross-spawn@^6.0.5:
|
cross-spawn@^6.0.4, cross-spawn@^6.0.5:
|
||||||
version "6.0.5"
|
version "6.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
|
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3370,7 +3374,7 @@ duplexer3@^0.1.4:
|
|||||||
version "0.1.4"
|
version "0.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
|
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
|
||||||
|
|
||||||
duplexer@^0.1.1:
|
duplexer@^0.1.1, duplexer@~0.1.1:
|
||||||
version "0.1.1"
|
version "0.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
|
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
|
||||||
|
|
||||||
@@ -3782,6 +3786,18 @@ event-emitter@~0.3.5:
|
|||||||
d "1"
|
d "1"
|
||||||
es5-ext "~0.10.14"
|
es5-ext "~0.10.14"
|
||||||
|
|
||||||
|
event-stream@~3.3.0:
|
||||||
|
version "3.3.4"
|
||||||
|
resolved "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571"
|
||||||
|
dependencies:
|
||||||
|
duplexer "~0.1.1"
|
||||||
|
from "~0"
|
||||||
|
map-stream "~0.1.0"
|
||||||
|
pause-stream "0.0.11"
|
||||||
|
split "0.3"
|
||||||
|
stream-combiner "~0.0.4"
|
||||||
|
through "~2.3.1"
|
||||||
|
|
||||||
events@^1.0.0:
|
events@^1.0.0:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
|
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
|
||||||
@@ -4266,6 +4282,10 @@ from2@^2.1.0, from2@^2.1.1:
|
|||||||
inherits "^2.0.1"
|
inherits "^2.0.1"
|
||||||
readable-stream "^2.0.0"
|
readable-stream "^2.0.0"
|
||||||
|
|
||||||
|
from@~0:
|
||||||
|
version "0.1.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe"
|
||||||
|
|
||||||
fs-minipass@^1.2.5:
|
fs-minipass@^1.2.5:
|
||||||
version "1.2.5"
|
version "1.2.5"
|
||||||
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d"
|
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d"
|
||||||
@@ -6374,6 +6394,10 @@ map-obj@^1.0.0, map-obj@^1.0.1:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d"
|
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d"
|
||||||
|
|
||||||
|
map-stream@~0.1.0:
|
||||||
|
version "0.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194"
|
||||||
|
|
||||||
map-visit@^1.0.0:
|
map-visit@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f"
|
resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f"
|
||||||
@@ -6447,6 +6471,10 @@ memory-fs@^0.4.0, memory-fs@~0.4.1:
|
|||||||
errno "^0.1.3"
|
errno "^0.1.3"
|
||||||
readable-stream "^2.0.1"
|
readable-stream "^2.0.1"
|
||||||
|
|
||||||
|
memorystream@^0.3.1:
|
||||||
|
version "0.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2"
|
||||||
|
|
||||||
meow@^3.6.0:
|
meow@^3.6.0:
|
||||||
version "3.7.0"
|
version "3.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb"
|
resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb"
|
||||||
@@ -6897,6 +6925,20 @@ npm-path@^2.0.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
which "^1.2.10"
|
which "^1.2.10"
|
||||||
|
|
||||||
|
npm-run-all@^4.1.3:
|
||||||
|
version "4.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.3.tgz#49f15b55a66bb4101664ce270cb18e7103f8f185"
|
||||||
|
dependencies:
|
||||||
|
ansi-styles "^3.2.0"
|
||||||
|
chalk "^2.1.0"
|
||||||
|
cross-spawn "^6.0.4"
|
||||||
|
memorystream "^0.3.1"
|
||||||
|
minimatch "^3.0.4"
|
||||||
|
ps-tree "^1.1.0"
|
||||||
|
read-pkg "^3.0.0"
|
||||||
|
shell-quote "^1.6.1"
|
||||||
|
string.prototype.padend "^3.0.0"
|
||||||
|
|
||||||
npm-run-path@^2.0.0:
|
npm-run-path@^2.0.0:
|
||||||
version "2.0.2"
|
version "2.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
|
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
|
||||||
@@ -7320,6 +7362,12 @@ path-type@^3.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
pify "^3.0.0"
|
pify "^3.0.0"
|
||||||
|
|
||||||
|
pause-stream@0.0.11:
|
||||||
|
version "0.0.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445"
|
||||||
|
dependencies:
|
||||||
|
through "~2.3"
|
||||||
|
|
||||||
pbkdf2@^3.0.3:
|
pbkdf2@^3.0.3:
|
||||||
version "3.0.16"
|
version "3.0.16"
|
||||||
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.16.tgz#7404208ec6b01b62d85bf83853a8064f8d9c2a5c"
|
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.16.tgz#7404208ec6b01b62d85bf83853a8064f8d9c2a5c"
|
||||||
@@ -7755,6 +7803,12 @@ prr@~1.0.1:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"
|
resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"
|
||||||
|
|
||||||
|
ps-tree@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.1.0.tgz#b421b24140d6203f1ed3c76996b4427b08e8c014"
|
||||||
|
dependencies:
|
||||||
|
event-stream "~3.3.0"
|
||||||
|
|
||||||
pseudomap@^1.0.2:
|
pseudomap@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
|
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
|
||||||
@@ -8787,7 +8841,7 @@ shebang-regex@^1.0.0:
|
|||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
|
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
|
||||||
|
|
||||||
shell-quote@1.6.1:
|
shell-quote@1.6.1, shell-quote@^1.6.1:
|
||||||
version "1.6.1"
|
version "1.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767"
|
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -8967,6 +9021,12 @@ split-string@^3.0.1, split-string@^3.0.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
extend-shallow "^3.0.0"
|
extend-shallow "^3.0.0"
|
||||||
|
|
||||||
|
split@0.3:
|
||||||
|
version "0.3.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/split/-/split-0.3.3.tgz#cd0eea5e63a211dfff7eb0f091c4133e2d0dd28f"
|
||||||
|
dependencies:
|
||||||
|
through "2"
|
||||||
|
|
||||||
sprintf-js@~1.0.2:
|
sprintf-js@~1.0.2:
|
||||||
version "1.0.3"
|
version "1.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||||
@@ -9050,6 +9110,12 @@ stream-browserify@^2.0.1:
|
|||||||
inherits "~2.0.1"
|
inherits "~2.0.1"
|
||||||
readable-stream "^2.0.2"
|
readable-stream "^2.0.2"
|
||||||
|
|
||||||
|
stream-combiner@~0.0.4:
|
||||||
|
version "0.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.0.4.tgz#4d5e433c185261dde623ca3f44c586bcf5c4ad14"
|
||||||
|
dependencies:
|
||||||
|
duplexer "~0.1.1"
|
||||||
|
|
||||||
stream-each@^1.1.0:
|
stream-each@^1.1.0:
|
||||||
version "1.2.2"
|
version "1.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.2.tgz#8e8c463f91da8991778765873fe4d960d8f616bd"
|
resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.2.tgz#8e8c463f91da8991778765873fe4d960d8f616bd"
|
||||||
@@ -9438,7 +9504,7 @@ through2@^2.0.0:
|
|||||||
readable-stream "^2.1.5"
|
readable-stream "^2.1.5"
|
||||||
xtend "~4.0.1"
|
xtend "~4.0.1"
|
||||||
|
|
||||||
through@^2.3.6, through@^2.3.8, through@~2.3.6:
|
through@2, through@^2.3.6, through@^2.3.8, through@~2.3, through@~2.3.1, through@~2.3.6:
|
||||||
version "2.3.8"
|
version "2.3.8"
|
||||||
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
|
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user