includePaths do not work with Webpack 2
See original GitHub issueHi everyone, I am using Windows 10 x64 and Webpack 2, with sass-loader version 4.1.1 , but can’t use standard syntax
use: [
{loader: 'style-loader'},
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'sass-loader',
options: {
includePaths: [
path.resolve(__dirname, 'vendor/zurb/foundation/scss'),
path.resolve(__dirname, 'node_modules/motion-ui/src'),
path.resolve(__dirname, 'resources/assets/sass')
],
sourceMap: true
}
}
]
The only way to get this to work is to use LoaderOptionsPlugin
new webpack.LoaderOptionsPlugin({
options: {
context: '/', // <- putting this line right under "options" did the trick
sassLoader: {
includePaths: [
path.resolve(__dirname, 'vendor/zurb/foundation/scss'),
path.resolve(__dirname, 'node_modules/motion-ui/src'),
path.resolve(__dirname, 'resources/assets/sass')
]
}
}
})
Otherwise it throws an error saying can’t import ‘foundation’ and so on. LoaderOptionsPlugin stops to work as of version 5.0.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:8
- Comments:32 (12 by maintainers)
Top Results From Across the Web
Can't set includePaths when using ExtractTextPlugin and ...
When building, I get the following error: Invalid configuration object. Webpack has been initialised using a configuration object that does not ...
Read more >How to configure includePaths for SASS on Mix?
In Elixir I could set includePaths like this: mix.sass( 'vendor/vendor.scss', '. ... I'm new to Webpack too, I think I have to know...
Read more >webpack: provide support for sass-loader `includePath` ...
In my webpack config I have this: { loader: 'sass-loader', options: { sourceMap: true, includePaths: [path.resolve('./src/js/components')], outFile: 'xx' }
Read more >sass-loader
Latest version: 13.2.0, last published: 2 months ago. ... Node Sass does not work with Yarn PnP feature and doesn't support @use rule....
Read more >Configuration Options - Renovate Docs
Renovate does not read/override the config from within each base branch if present. ... Shareable config presets only work with the JSON format....
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 Free
Top 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
The sass-loader has its own loader pipeline. This configuration fixed the issue:
This is my config and it’s working with your sass-loader-test repository