mantinedev / next-pages-template

Mantine + Next.js pages router template
https://mantine.dev/guides/next/
MIT License
485 stars 131 forks source link

Using a library that uses Nullish Coalescing operator (??) breaks Storybook build #27

Closed fernandes77 closed 8 months ago

fernandes77 commented 2 years ago

Storybook doesn't work when we add a library (in this case, react-facade) that uses the Nullish Coalescing operator ?? added in TypeScript 3.7.

Here's a screenshot of the error:

2022-11-18_11-01
fernandes77 commented 2 years ago

Here's a fix: specify a loader on webpack config:

module.exports = async ({ config, mode }) => {
  config.module.rules.push({
    test: /\.(mjs|jsx?)$/,
    loader: 'esbuild-loader'
  });

  return config;
};

We chose esbuild-loader which is faster than babel-loader but either one works.