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.

Add less as an allowed cssExtension when extending create-react-app configurations

See original GitHub issue

Is your feature request related to a problem? Please describe. I’m trying to integrate the storybook into a project at work. We’re running a fork of create-react-apps react-scripts package, to build the application. @storybook/react is ALMOST able to pick up on it automatically and without requiring any custom configuration - except that it breaks its neck on the .less files.

Describe the solution you’d like https://github.com/storybooks/storybook/blob/11d9a10f33a92d405ce63231beb28f9b46194ee6/app/react/src/server/cra-config.js#L12

Adding '.less' to the cssExtensions-array makes it work.

Describe alternatives you’ve considered Until this is fixed I have to manually override the configuration with a custom .storybook/webpack.config.js file. It works, and I’m used to that from other projects, I just think this is such a low hanging fruit that it would be a pity not to add it to the list.

Are you able to assist bring the feature to reality? Sure. But since the amount of work needed here is so small, I think it might be easier for something familiar with the project.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
shilmancommented, May 28, 2019

I think we should handle less via a preset, like preset-typescript, and not spend time on CRA forks unless we get it “for free”

0reactions
mrmckebcommented, May 28, 2019

Hi @gustavnikolaj, that PR fixed support for custom react-scripts packages, we added support for those last year. What that PR doesn’t do, is allow Storybook users to accidentally implement things in Storybook that won’t work with CRA - at least not without creating a custom config.

What you’re asking would do that, which is why I am suggesting you simply add this to the config yourself. Storybook is a highly configurable tool, and the team do a great job of keeping it that way - the custom Webpack config is a huge part of that story 😃

What would be ideal, is if we could load that list of extensions from react-scripts. Perhaps you could raise a PR for that if you’re interested?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using .less files with React - Stack Overflow
npm i less less-loader; open webpack.config.js file located at config folder created after eject script: look at the return value of exported ...
Read more >
How to Style Your React App – 5 Ways to Write CSS in 2021
Extending / Inheritance: You can add onto style rules by extending them. To extend rules, you create your own selector which can be...
Read more >
Overriding the Create-React-App Webpack Configuration ...
After adding the rewire package to my devDependencies in package.json , I created a build.js file to override the Webpack build: // in...
Read more >
How to use Sass and CSS Modules with create-react-app
A short yet detailed guide to styling components with create-react-app ... Up until the release of create-react-app v2, if you wanted to include ......
Read more >
Advanced Configuration - Create React App
Variable Development Production BROWSER ✓ Used 🚫 Ignored BROWSER_ARGS ✓ Used 🚫 Ignored HOST ✓ Used 🚫 Ignored
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