Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "type": "module" to package.json and rename CommonJS modules to .cjs #156

Merged
merged 1 commit into from
Aug 30, 2021

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Aug 30, 2021

@benjamn benjamn self-assigned this Aug 30, 2021
@benjamn benjamn merged commit fdb2c6c into main Aug 30, 2021
@benjamn benjamn deleted the type-module-in-package.json branch August 30, 2021 18:34
@SimenB
Copy link

SimenB commented Sep 30, 2021

Hiya! Big fan of this change, but it makes Metro (aka React Native) unhappy. See facebook/metro#535. Ideally FB would fix this in Metro, but since they haven't bothered to respond in the issue it doesn't seem like it's a about to happen...

@SimenB
Copy link

SimenB commented Sep 30, 2021

I was able to work around it with this (stripped down from our larger one using Expo, so copy with caution) metro config:

const { getDefaultConfig } = require('metro-config');

const { resolver: defaultResolver } = getDefaultConfig.getDefaultValues();

const configuration = {
  resolver: { sourceExts: [...defaultResolver.sourceExts, 'cjs'] },
};

module.exports = configuration;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants