V
V
Viorel2017-09-22 14:04:01
webpack
Viorel, 2017-09-22 14:04:01

webpack error, how to fix?

I decided to learn webpack there is a stylesheet file from js

const path = require("path");
const ExtractTextPlugin = require("extract-text-webpack-plugin");

function cssLoaders(options) {
  var cssLoader = {
    loader: 'css-loader',
    options: {
      minimize: options.extract,
      sourceMap: options.sourceMap,
      modules: true
    }
  }
  function generateLoaders(loader) {
    var loaders = [cssLoader]
    if(loader) {
    	loaders.push({
    		loader: loader,
    		options: {
      sourceMap: options.sourceMap,
    }
    	})
    }
    if (options.extract) {
    	return ExtractTextPlugin.extract({
    		use: loaders,
    		fallback: 'style-loader'
    	})
    } else {
    	return ['style-loader'].concat(loaders);
    }
  }
  return {
    css: generateLoaders(),
    scss: generateLoaders('sass-loader')
  }
}

exports.styleLoaders = function (options) {
  var output = [],
  var loaders = cssLoaders(options)
  for (var ext in loaders) {
    var loader = loaders[ext],
    output.push({
      test: new RegExp('\\.' + ext + '$'),
      use: loader
    })
  }
  return output;
}

and when running the npm run build command , an error appears how to fix it, give me an idea?
8fdf4c1d5d06419bae11706c73b0d11c.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Drapeza, 2017-09-22
@SuperOleg39ru

var output = [],
var loaders = {}

Replace the comma with a semicolon.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question