function generateLoaders(loader, loaderOptions) { const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) { if (loader == 'less') { loaders.push( { loader: 'less-loader', options: Object.assign({}, loaderOptions, { sourceMap: options.sourceMap }) }, { loader: 'sass-resources-loader', options: { resources: [path.resolve(__dirname, '../src/style/variables.less')] } } ); } else { loaders.push({ loader: loader + '-loader', options: Object.assign({}, loaderOptions, { sourceMap: options.sourceMap }) }) } }
...
function lessResourceLoader() { var loaders = [ cssLoader, 'less-loader', { loader: 'sass-resources-loader', options: { resources: [ path.resolve(__dirname, '../src/style/variables.less') ] } } ]; if (options.extract) { return ExtractTextPlugin.extract({ use: loaders, fallback: 'vue-style-loader' }); } else { return ['vue-style-loader'].concat(loaders); } }
return { ... less: lessResourceLoader(), .... }
|