question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

πŸ”₯🐞 Attempted import error: 'AgendaListProps' is not exported from './expandableCalendar/agendaList'.

See original GitHub issue

Description

I’m trying to install react-native-calendars onto our React-Native for Web x NextJS platform. I have setup the next-transpile-modules 'module in our next.config.js which helped with the initial static Proptypes transpilation issue but now i am getting an export error.

Expected Behavior

Expecting the module to work πŸ˜‰

Observed Behavior

Page fails to load with error

Error

./node_modules/react-native-calendars/src/index.ts
Attempted import error: 'AgendaListProps' is not exported from './expandableCalendar/agendaList'.

Environment

Please run these commands in the project folder and fill in their results:

  • npm ls react-native-calendars: └── react-native-calendars@1.1269.0

  • npm ls react-native: └─┬ @react-native-community/cli@4.14.0 └── react-native@0.63.2 deduped

  • npm ls next β”œβ”€β”¬ next-i18next@8.8.0 β”‚ └── next@10.1.2 deduped β”œβ”€β”¬ next-router-mock@0.1.4 β”‚ └── next@10.1.2 deduped └── next@10.1.2

  • npm ls react β”œβ”€β”¬ @apollo/client@3.4.12 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ @emotion/react@11.5.0 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ @emotion/styled@11.3.0 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ @fortawesome/react-fontawesome@0.1.15 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ @maisonsport/common-ui@1.3.8 β”‚ β”œβ”€β”¬ react-native@0.63.2 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native β”‚ β”œβ”€β”¬ react-test-renderer@16.14.0 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”œβ”€β”€ react@17.0.2 deduped β”‚ └─┬ styled-components@5.3.3 β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”œβ”€β”¬ @material-ui/unstyled@5.0.0-alpha.44 β”‚ β”œβ”€β”¬ @material-ui/utils@5.0.0-beta.5 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ @mui/material@5.1.0 β”‚ β”œβ”€β”¬ @mui/core@5.0.0-alpha.54 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”œβ”€β”¬ @mui/system@5.1.0 β”‚ β”‚ β”œβ”€β”¬ @mui/private-theming@5.1.0 β”‚ β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”‚ β”œβ”€β”¬ @mui/styled-engine@5.1.0 β”‚ β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”œβ”€β”¬ @mui/utils@5.1.0 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”œβ”€β”¬ react-transition-group@4.4.2 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ @react-hook/window-size@3.0.7 β”‚ β”œβ”€β”¬ @react-hook/debounce@3.0.0 β”‚ β”‚ β”œβ”€β”¬ @react-hook/latest@1.0.3 β”‚ β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”œβ”€β”¬ @react-hook/event@1.2.3 β”‚ β”‚ β”œβ”€β”¬ @react-hook/passive-layout-effect@1.2.1 β”‚ β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”œβ”€β”¬ @react-hook/throttle@2.2.0 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ @reduxjs/toolkit@1.6.1 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ @rooks/use-window-size@4.11.2 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ @stripe/react-stripe-js@1.4.1 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ @testing-library/react@11.2.7 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ next-i18next@8.8.0 β”‚ β”œβ”€β”¬ react-i18next@11.12.0 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ next-router-mock@0.1.4 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ next@10.1.2 β”‚ β”œβ”€β”¬ @next/react-dev-overlay@10.1.2 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”œβ”€β”€ react@17.0.2 deduped β”‚ β”œβ”€β”¬ styled-jsx@3.3.2 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ └─┬ use-subscription@1.5.1 β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”œβ”€β”¬ pure-react-carousel@1.27.6 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-cookie@4.1.1 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-countup@5.2.0 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-day-picker@7.4.10 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-dom@17.0.2 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-google-recaptcha@2.1.0 β”‚ β”œβ”€β”¬ react-async-script@1.2.0 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-hook-form@6.15.8 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-markdown@6.0.3 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-native-web@0.15.7 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-redux@7.2.5 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-switch@6.0.0 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-toastify@7.0.4 β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-use@17.3.1 β”‚ β”œβ”€β”¬ nano-css@5.3.4 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ β”œβ”€β”¬ react-universal-interface@0.6.2 β”‚ β”‚ └── react@17.0.2 deduped invalid: β€œ16.13.1” from node_modules/react-native, β€œ^16.14.0” from node_modules/react-test-renderer β”‚ └── react@17.0.2 deduped β”œβ”€β”¬ react-waypoint@10.1.0 β”‚ └── react@17.0.2 deduped └── react@17.0.2

next.config.js

/* eslint-disable no-param-reassign */
const withTM = require('next-transpile-modules')([
  'styled-components/native',
  'react-native-calendars'
]);
const withImages = require('next-images');

const { i18n, react } = require('./next-i18next.config');

const pageHeaders = require('./next_config_util/page-headers');

module.exports = withTM(
  withImages({
    headers: async () => pageHeaders,
    rewrites: async () => ({
      beforeFiles: [
        {
          source: '/status',
          has: [
            {
              type: 'header',
              key: 'accept',
              value: '.*[+|/]json',
            },
          ],
          destination: '/api/status',
        },
      ],
    }),
    webpack: (config) => {
      config.module.rules.map((rule) => {
        if (rule.test !== undefined && rule.test.source.includes('|svg|')) {
          rule.test = new RegExp(rule.test.source.replace('|svg|', '|'));
        }

        return rule;
      });

      config.module.rules.push({
        test: /\.svg$/,
        use: [
          {
            loader: '@svgr/webpack',
            options: {
              svgoConfig: {
                plugins: [{
                  removeViewBox: false,
                }],
              },
            },
          },
        ],
      });

      config.resolve.alias = {
        ...(config.resolve.alias || {}),
        // Transform all direct `react-native` imports to `react-native-web`
        'react-native$': 'react-native-web',
      };
      config.resolve.extensions = [
        '.web.js',
        '.web.ts',
        '.web.tsx',
        ...config.resolve.extensions,
      ];
      return config;
    },
    crossOrigin: 'anonymous',
    distDir: 'build',
    i18n,
    react,
  }),
);

Also specify:

  1. Device/emulator/simulator & OS version: Web

Screenshots

Screenshot 2021-11-17 at 15 12 27

Thank you 😊

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
yairoprocommented, Jan 19, 2022

Thanks for the 1.1276.0 update which includes the fix

1reaction
yairoprocommented, Jan 18, 2022

I’ve gone back to 1.1266.0 before the disaster

Read more comments on GitHub >

github_iconTop Results From Across the Web

0 - Stack Overflow
Can somebody help me understand why I am getting this error even if I have imported the proper module? reactjs Β· react-bootstrap Β·...
Read more >
attempted import error is not exported from - You.com
On upgrading the version of Ant Design to v4, one of the major breaking changes have been that Icon is no longer exported...
Read more >
Your browser can't play this video. Learn more - YouTube
SET YOUR LIKE THERE πŸ”ΊπŸ‘†πŸ‘†Failed to compile./src/App.jsAttempted import error : 'Articles' is not exported from './components/Articles'.
Read more >
Attempted import error: 'MDBBtnFixed&#38
after I upgraded mdbreact to 4.19 now I get error: Attempted import error: 'MDBBtnFixed' is not exported from 'mdbreact'. I didnt change anything...
Read more >
'useGlobalTheme' is not exported from '@atlaskit/theme ...
Attempted import error : 'useGlobalTheme' is not exported from '@atlaskit/theme/components' ... Hi there! What version of @atlaskit/theme are youΒ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found