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.

Next.js Typescript Compilation Warning

See original GitHub issue

🐛 Bug Report

I got a postcss error while using react-spectrum with Next.js 12 & Typescript.

🤔 Expected Behavior

There shouldn’t be any warning or errors.

😯 Current Behavior

Error prevents the UI from re-rendering with new styles.

wait  - compiling / (client and server)...
warn  - ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[7].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[7].use[2]!./node_modules/@react-spectrum/breadcrumbs/dist/main.css
Warning

(1:83) postcss-preset-env: start value has mixed support, consider using flex-start instead

🔦 Context

Trying to test out react spectrum components with Next.js 12 and typescript.

💻 Code Sample

_app.tsx

function MyApp({ Component, pageProps }: AppProps) {
  const { locale } = useLocale();
  return (
    <SSRProvider>
      <Provider theme={lightTheme} locale={locale}>
        <Component {...pageProps} />
      </Provider>
    </SSRProvider>
  );
}

next.config.js

const withTM = require('next-transpile-modules')([
  '@adobe/react-spectrum',
  ...
]);

module.exports = withTM({
  reactStrictMode: true,
});

🌍 Your Environment

Software Version(s)
react-spectrum ^3.15.0
Browser Chrome@latest
Operating System MacOs M1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
snowystingercommented, Dec 8, 2021

ok, I took a look, here it is working https://codesandbox.io/s/relaxed-hoover-45cut?file=/pages/_app.tsx

you’ve conflated colorScheme and theme for your provider props, see https://react-spectrum.adobe.com/react-spectrum/Provider.html#themes

0reactions
hamidihekmatcommented, Dec 8, 2021

ok, I took a look, here it is working https://codesandbox.io/s/relaxed-hoover-45cut?file=/pages/_app.tsx

you’ve conflated colorScheme and theme for your provider props, see https://react-spectrum.adobe.com/react-spectrum/Provider.html#themes

Oh I see, I cloned the repo that @reidbarber provided. I hope they fix the warning issues in the next update regarding postcss-preset-env

./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[7].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[7].use[2]!./node_modules/@react-spectrum/breadcrumbs/dist/main.css
Warning

(1:745) postcss-preset-env: start value has mixed support, consider using flex-start instead 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignoring TypeScript Errors - next.config.js
Ignoring TypeScript Errors. Next.js fails your production build ( next build ) when TypeScript errors are present in your project. If you'd like ......
Read more >
A Guide for Next.js with TypeScript - Refine Dev
If you happen to have TypeScript errors while running next build , Next.js will fail the build but you can disable the type...
Read more >
Next.js, TypeScript, ESLint. Compilation - Stack Overflow
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: src ...
Read more >
isolatedModules - TSConfig Option - TypeScript
While you can use TypeScript to produce JavaScript code from TypeScript code, ... Setting the isolatedModules flag tells TypeScript to warn you if...
Read more >
How To Ignore The Next Line In TypeScript? - Tim Mousk
The TypeScript compiler is excellent at showing errors and warning when it detects something is wrong with the code.
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