linaria: Deleting outDir breaks Linaria for good

Do you want to request a feature or report a bug?

Bug.

What is the current behavior?

I sometimes see stale generated stylesheets (more on that perhaps in future issues), so I find myself deleting ./src/.linaria-cache (my outDir) to try to start fresh. After I do this, Linaria fails to build, spewing a bunch of errors like:

`Error in ./src/ui/components/chrome/SiteServicesMenu.js
Module not found: [CaseSensitivePathsPlugin] `src/.linaria-cache/src/ui/components/chrome/SiteServicesMenu.css` does not match the corresponding path on disk - File does not exist.
**If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can `yarn install` and `yarn test`.**

Restarting Webpack or clearing the Babel cache does not help. I’m stuck.

What is the expected behavior?

Missing output files get rebuilt instead of throwing errors.

Please provide your exact Babel configuration and mention your Linaria, Node, Yarn/npm version and operating system.

This is with create-react-app, Node 8.9.0, Webpack 1.14.0, Babel 6.2.7. This is how I configured Babel:

{
    "presets": [
      "react-app",
      [
        "linaria/babel",
        {
          "outDir": "./src/.linaria-cache"
        }
      ]
    ]
  }

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

We just didn’t encounter this in our testing, but that’s definitely something buggy which we need to fix. Other than that, building the project doesn’t mean you need to run in production mode, it’s all good with dev (which should be optimised for speed, so no minification et. al.). What’s important here is to get all files processed by Babel (which runs Linaria). You can also try cache: false in the preset options: https://github.com/callstack/linaria/blob/master/docs/BABEL_PRESET.md#options because it might be related