Bundle files that aren’t required or imported:
const ExtractSass = {
entry: glob_entries('./public/styles/external/*.less'),
output: {
filename: './.build/junk/[name].[chunkhash].js',
},
module: {
loaders: [{
test: /\.less$/,
loader: ExtractTextPlugin.extract(
'isomorphic-style-loader',
'css-loader?modules&localIdentName=[name]_[local]',
'less-loader'
)
}]
},
plugins: [
new ExtractTextPlugin('./.build/css/[name].css')
]
};
Dependencies
The trick: create JS files for each LESS file, then extract them to CSS.
#webpack#javascript
About Hemanth HM
Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.