I use Webpackto create our project with a plugin ExtractTextPluginto split our CSS into separate files. It works well for most CSS / LESS / SASS files in a project, with the exception of one file, vendor.css, which belongs to a third-party library. As soon as I include this file in my project, I get a ReferenceError: window not defined message . If I do not use ExtractTextPlugin, error messages will not appear.
My webpack.config.js part of the LESS configuration is below (full file here ):
new ExtractTextPlugin(__dirname + '/Content/js/styles/styles.css'),
...
module: {
{
test: /\.less$/,
loader: ExtractTextPlugin.extract(
'style-loader',
'css-loader!' +
'autoprefixer-loader!' +
'less-loader'
)
}
}
Full error message output here .
LESS:
styles.js, vendor.less, CSS Bower.
styles.js
require('../../../less/vendor.less');
vendor.less
@import (css) "~vendor-ui-bootstrap/dist/css/arena.css";
arena.css CSS.