I'm trying to pass some data to SCSS, based on entry point. I will have two themes and I have to know what theme Im currently bundling.
Webpack entry points :
webpack: {
entry: {
toyota: path.resolve(__dirname, '../entries/theme.toyota.js'),
lexus: path.resolve(__dirname, '../entries/theme.lexus.js'),
},
Then, I would like to recognise the entry point, and pass that as variable to SCSS:
test: /\.s?css$/,
exclude: /node_modules/,
use: [{
loader: 'sass-loader',
options: {
data: '$brand: "' + entryPointName +'";',
sourceMap: true
}
},
]
I already tried [name]
but no luck...
I could achieve that by running build again with different ENV variable, but i was hoping to achieve that with one task (for faster build time with watch).
Is there any way to achieve that?