Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Commit

Permalink
Update metro config to support loading .cjs files
Browse files Browse the repository at this point in the history
Workaround for metro deficiency: facebook/metro#535

Caused by stylis shipping a .cjs file: thysultan/stylis#233

Fix from emotion-js/emotion#1986
  • Loading branch information
voidrender committed Sep 2, 2020
1 parent 9fde0ab commit d868225
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions metro.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const { getDefaultConfig } = require('metro-config');

module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
module.exports = (async () => {
const {
resolver: { sourceExts },
} = await getDefaultConfig();
return {
resolver: {
// Add cjs extension so stylis will load.
sourceExts: [...sourceExts, 'cjs'],
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
})();

0 comments on commit d868225

Please sign in to comment.