Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When used this plugin with sass-loader (version ^10.0.2) and craco is giving Cannot find module 'sass-loader/dist/importsToResolve' when used in webpack config #91

Open
vjagetiya-jeavio opened this issue Sep 28, 2020 · 0 comments

Comments

@vjagetiya-jeavio
Copy link

vjagetiya-jeavio commented Sep 28, 2020

Reference of ticket opened with sass-loader, which recommended to open issue with antd-scss-theme-plugin

https://github.com/webpack-contrib/sass-loader/issues/890

Refer following for craco.config.js

`const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin');
const AntdScssThemePlugin = require('antd-scss-theme-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const isProduction = process.env.NODE_ENV === 'production';

module.exports = {
babel: {
plugins: [
['import', {
'libraryName': 'antd',
'style': true
}]
]
},
webpack: {
configure: {
module: {
rules: [
{
test: /.s(a|c)ss$/,
use: [
!isProduction ? 'style-loader' : MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
sourceMap: !isProduction,
modules: true
},
},
AntdScssThemePlugin.themify({
loader: 'sass-loader',
options: {
sourceMap: !isProduction,
implementation: require('node-sass')
},
}),
],
},
{
test: /.less$/,
use: [
{
loader: 'style-loader',
options: {
sourceMap: !isProduction,
},
},
{
loader: 'css-loader',
options: {
importLoaders: 1,
sourceMap: !isProduction,
},
},
AntdScssThemePlugin.themify('less-loader'),
],
},
]
},
plugins: [
new AntdDayjsWebpackPlugin({
replaceMoment: true,
preset: 'antd'
}),
new AntdScssThemePlugin(path.join('./theme.scss')),
new MiniCssExtractPlugin({
filename: !isProduction ? '[name].css' : '[name].[hash].css',
chunkFilename: !isProduction ? '[id].css' : '[id].[hash].css'
})
]
},
}
};`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant