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.

Error when trying to load minified css

See original GitHub issue

Bug Report

Describe the bug I’m using a library (react-tippy) which requires to load a css file in order to look as expected. When I load the component which imports that css file, I get an error of Unexpected token .*

A clear and concise description of what the bug is. I get the following error on the console which stops the server from starting …

Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
> .tippy-touch{cursor:pointer!important}.tippy-notransition{transition:none!important}.tippy-popper{max-width:400px;-webkit-perspective:800px;perspective:800px;z-index:9999;outline:0;transition-timing-function:cubic-bezier( ...

To Reproduce

In order to

  1. git clone https://github.com/EmaSuriano/docz-css-bug-example.git
  2. yarn install
  3. yarn dev

Expected behavior

Start the server as expected. screen shot 2018-07-20 at 19 11 11

Enviroment

  • OS: OSX
  • Node/npm version: 10.6.0

Additional context/Screenshots

The workaround I found was to format the file with prettier and it seems the server to be working. The problem with is that I have to store the file in my codebase, which I really don’t want to do because if the owner of the library made a change on the styles I have to manually change it …

This is the branch with the work around --> https://github.com/EmaSuriano/docz-css-bug-example/tree/formatting-css-file

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
tsnolan23commented, Jul 22, 2018

@EmaSuriano I was able to get your project running by modifying the bundler config without the CSS plugin:

// doczrc.js
export default {
  modifyBundlerConfig: config => {
    config.module.rules.push({
      test: /\.css$/,
      use: ["style-loader", "css-loader"]
    });
    return config;
  }
};

It did require additional dependencies, then, though - style-loader and css-loader.

Not sure if that’s the proper way to achieve the result, but it does work!

2reactions
EmaSurianocommented, Jul 22, 2018

It works! 🎉 But I’m thinking if this bug should be fixed in docz-plugin-css because this kind of transformation should be taking care of by this plugin …

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when trying to load minified css · Issue #160 · doczjs/docz
The workaround I found was to format the file with prettier and it seems the server to be working. The problem with is...
Read more >
css - Minification error with minifycss - Stack Overflow
Have you tried linting your input css? There may be a problem hidden in there somewhere... PS. My output differs from yours as...
Read more >
Loading CSS file error - WordPress.org
Hi Marko, I have minify turned off completely as everything is already minified during the build process. It only seems to happen with...
Read more >
"An error occurred trying to load the resource" error for ...
Hello, I'm working on a simple website that has couple of html files, with bootstrap installed by npm packages. I've imported into my...
Read more >
Solving the React Error: Not Picking Up CSS Style | Pluralsight
In this guide, you will learn about the errors that can occur while importing a CSS file into your React file.
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