Skip to content

Commit

Permalink
feat: add babel-loader in example,support to web
Browse files Browse the repository at this point in the history
  • Loading branch information
dohooo committed Dec 11, 2021
1 parent 7220886 commit 1edc9c3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"test": "jest"
},
"dependencies": {
"babel-loader": "^8.2.3",
"expo": "^41.0.0",
"expo-splash-screen": "~0.10.2",
"react": "16.13.1",
Expand Down
26 changes: 13 additions & 13 deletions example/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ const root = path.resolve(__dirname, '..');
const node_modules = path.join(__dirname, 'node_modules');

module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
const config = await createExpoWebpackConfigAsync(env, argv);

config.module.rules.push({
test: /\.(js|jsx|ts|tsx)$/,
include: path.resolve(root, 'src'),
use: 'babel-loader',
});
config.module.rules.push({
test: /\.(js|jsx|ts|tsx)$/,
include: path.resolve(root, 'src'),
use: 'babel-loader',
});

// We need to make sure that only one version is loaded for peerDependencies
// So we alias them to the versions in example's node_modules
Object.assign(config.resolve.alias, {
...resolver.extraNodeModules,
'react-native-web': path.join(node_modules, 'react-native-web'),
});
// We need to make sure that only one version is loaded for peerDependencies
// So we alias them to the versions in example's node_modules
Object.assign(config.resolve.alias, {
...resolver.extraNodeModules,
'react-native-web': path.join(node_modules, 'react-native-web'),
});

return config;
return config;
};
12 changes: 11 additions & 1 deletion example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3254,6 +3254,16 @@ [email protected]:
pify "^4.0.1"
schema-utils "^2.6.5"

babel-loader@^8.2.3:
version "8.2.3"
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.2.3.tgz#8986b40f1a64cacfcb4b8429320085ef68b1342d"
integrity sha512-n4Zeta8NC3QAsuyiizu0GkmRcQ6clkV9WFUnUf1iXP//IeSKbWjofW3UHyZVwlOB4y039YQKefawyTn64Zwbuw==
dependencies:
find-cache-dir "^3.3.1"
loader-utils "^1.4.0"
make-dir "^3.1.0"
schema-utils "^2.6.5"

babel-plugin-dynamic-import-node@^2.3.3:
version "2.3.3"
resolved "https://registry.npm.taobao.org/babel-plugin-dynamic-import-node/download/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3"
Expand Down Expand Up @@ -8327,7 +8337,7 @@ make-dir@^2.0.0, make-dir@^2.1.0:
pify "^4.0.1"
semver "^5.6.0"

make-dir@^3.0.2:
make-dir@^3.0.2, make-dir@^3.1.0:
version "3.1.0"
resolved "https://registry.nlark.com/make-dir/download/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
integrity sha1-QV6WcEazp/HRhSd9hKpYIDcmoT8=
Expand Down

0 comments on commit 1edc9c3

Please sign in to comment.