@import in css files loaded via webpack results in "File to import not found or unreadable"
See original GitHub issueGreetings, 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:
- Created 8 years ago
- Comments:8 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 😓
@superkat64 - That’s already configured in master. https://github.com/coryhouse/react-slingshot/blob/master/webpack.config.prod.js#L129