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.

@import in css files loaded via webpack results in "File to import not found or unreadable"

See original GitHub issue

Greetings, Something that use to work on other projects that did not use ExtractTextPlugin seems to not work here.

So, I have installed node-sass + node-bourbon.

Here is my loaders array:

const bourbon = require('node-bourbon').includePaths;
  if (env === productionEnvironment ) {
    // generate separate physical stylesheet for production build using ExtractTextPlugin. This provides separate caching and avoids a flash of unstyled content on load.
    loaders.push({
      test: /(\.css|\.scss)$/,
      include: path.join(__dirname, 'src'),
      loader: ExtractTextPlugin.extract("css?sourceMap!sass?outputStyle=expanded&includePaths[]=" + bourbon)
    });
  } else {
    loaders.push({
      test: /(\.css|\.scss)$/,
      include: path.join(__dirname, 'src'),
      loaders: ['style', 'css?sourceMap', 'sass?outputStyle=expanded&includePaths[]=' + bourbon]
    });
  }

and in styles.scss, I import bourbon globally as i normally would: @import 'bourbon'; However, this results in the following error:

@import 'bourbon';

      File to import not found or unreadable: bourbon
Parent style sheet: stdin
      in /Users/sirrah/Koding/work/thirdshelf/loyalty-grader/src/styles/styles.scss (line 2, column 1)
Error: 

@import 'bourbon';

      File to import not found or unreadable: bourbon
 Parent style sheet: stdin
       in /Users/sirrah/Koding/work/thirdshelf/loyalty-grader/src/styles/styles.scss (line 2, column 1)
     at options.error (/Users/sirrah/Koding/work/thirdshelf/loyalty-grader/node_modules/node-sass/lib/index.js:277:32)
  @ ./src/styles/styles.scss 4:14-280 13:2-17:4 14:20-286

This use to work fine, however I believe that in this case it is because of ExtractTextPlugin since it is the only difference between me doing this on previous projects and this one.

Any ideas?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
superkat64commented, Nov 21, 2018

@coryhouse Thank you so much! I must have removed it trying to figure it all out on accident or I’m just blind. Really appreciate the quick response

Edit: I was looking at the wrong config file the whole time 😓

1reaction
coryhousecommented, Nov 21, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack error: File to import not found or unreadable
webpack error: File to import not found or unreadable: bourbon , how to ... I am trying to load the Bourbon package inside...
Read more >
style-loader - webpack
Automatically injects styles into the DOM using one <style></style> . ... Source maps do not work. ... import styles from "./styles.css"; const divElement...
Read more >
Using with Preprocessors - Tailwind CSS
A guide to using Tailwind with common CSS preprocessors like Sass, Less, ... The canonical plugin for handling this with PostCSS is postcss-import....
Read more >
Sass · Bootstrap v5.0
Assuming you're using a package manager like npm, you'll have a file structure that ... In your custom.scss , you'll import Bootstrap's source...
Read more >
webpack/webpack - Gitter
is it the webpack dev server? if so how do i import it? no where in the docs ... I'm using the requiring...
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