Answer the question
In order to leave comments, you need to log in
How to change file name in wabpack loader and pass new name to another loader (or how to change styles at assembly level)?
How do I tell webpack to convert the name of a file that matches the '*__style__.css' mask to a different name depending on the parameters passed to webpack and call the next loader with the converted name?
Here is an example config:
rules: [
{
test: /.*__style__\.css$/,
loader: /*
... как заменить '__style__' на `${env.STYLE_REF}` и
and передать дальше в css-loader ????
*/
},
/*...и т.д. ....*/
import React from 'react';
import css from './__style__.css';
/* ... component code ...*/
Answer the question
In order to leave comments, you need to log in
The first thing that comes to mind is something like this:
And from the webpack to the code, pass the theme variable through DefinePlugin.
The second option is to dynamically generate resolve.alias and write import '__current-theme.css' in the code. Something like this:
alias: {
'__current-theme.css': path.resolve(__dirname, process.env.STYLE_REF)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question