Skip to content

Why does importing LESS (.less) files fail silently and what do I do if I need to use LESS and want to use CRA? #1293

Closed
@godmar

Description

@godmar

The documentation clearly states that LESS or Sass are not supported. In Issue #78 I read that this seems to be a touchy issue.

If I do this in index.js:

import './test.less';

and create test.less with the following content:

Should I be seeing a compile error?

I am not, in fact, seeing a compile error, or any error, for that matter. The application starts, just without the LESS code in test.less. I consider this a defect of some kind.

I was affected by this issue when trying to port a medium-size React.JS application (about 1 year old), which used LESS, to create-react-app. Our motivation for attempting this were that we never could get HMR to work in the old app, making front-end development tediously slow (in CRA, it mostly works), and that we want to use the rest of CRA's webpack config, including its Babel and eslint presets, particularly with an eye towards upgrading to Webpack 2.0. In a 1 year old application, several packages are multiple semantic versions behind (react, react-bootstrap, redux, redux-forms, ... you name it), and just waiting for compile errors without incremental compilation would is aggravating.

If create-react-app is not the tool for that use case, what is? Maybe we need 'maintain-react-app' project, or a react-cli project. Irony: Googling for react-cli finds this project.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions