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

The requested module '/@npm/scheduler' does not provide an export named 'unstable_NormalPriority' #922

Closed
Aloento opened this issue Apr 12, 2022 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@Aloento
Copy link

Aloento commented Apr 12, 2022

Describe the bug

Uncaught SyntaxError: The requested module '/@npm/scheduler' does not provide an export named 'unstable_NormalPriority' (at react-context-selector:3:36)

from import { unstable_NormalPriority as NormalPriority, unstable_runWithPriority as runWithPriority } from 'scheduler';
in \node_modules\@fluentui\react-context-selector\lib\createContext.js

unstable_NormalPriority from \node_modules\scheduler\cjs\scheduler.{Env}.js
defined in \node_modules\@types\scheduler\index.d.ts

To Reproduce
yarn create wmr & yarn add @fluentui/react-components

index.js

export function App() {
  return (
    <LocationProvider>
+      <FluentProvider theme={webLightTheme}>
        <div class="app">
          <Header />
          <ErrorBoundary>
            <Router>
              <Route path="/" component={Home} />
              <Route path="/about" component={About} />
              <Route default component={NotFound} />
            </Router>
          </ErrorBoundary>
        </div>
+      </FluentProvider>
    </LocationProvider>
  );
}
@Aloento Aloento added the bug Something isn't working label Apr 12, 2022
@rschristian
Copy link
Member

rschristian commented Apr 12, 2022

Just want to add to this issue that adding @rollup/plugin-commonjs does make the error disappear for me, so it sounds like once we narrow that weird Rollup version bug down you should have a working solution to this.

For any other readers, you can do the following:

$ yarn add @rollup/plugin-commonjs

wmr.config.mjs

 import { defineConfig } from 'wmr';
+import commonjs from '@rollup/plugin-commonjs';

 // Full list of options: https://wmr.dev/docs/configuration
 export default defineConfig({
     /* Your configuration here */
     alias: {
         react: 'preact/compat',
         'react-dom': 'preact/compat'
     },
+    plugins: [commonjs()]
 });

Edit: Doesn't work in dev, so not a solution.

@Aloento Aloento closed this as completed Apr 12, 2022
@Aloento Aloento reopened this Apr 12, 2022
@developit
Copy link
Member

@Aloento there's no need to create a new issue for each broken package - they're all the same issue: WMR doesn't support conditional re-exports in CommonJS modules. This affects all packages published by the React team, and a number of packages from the React community that have copied their packaging design.

@developit developit added the duplicate This issue or pull request already exists label Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
3 participants