How to use extract-text-webpack-plugin - 10 common examples

To help you get started, we’ve selected a few extract-text-webpack-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github waysact / webpack-subresource-integrity / test / test-webpack.js View on Github external
function createExtractTextLoader() {
  if (ExtractTextPluginVersion.match(/^1\./)) {
    // extract-text-webpack-plugin 1.x
    return ExtractTextPlugin.extract('style-loader', 'css-loader');
  }
  // extract-text-webpack-plugin 2.x
  return ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' });
}
github code-mcx / mango-music / scripts / overrides-config.prod.js View on Github external
module.exports = function(config) {
  // Define the root path alias
  let alias = config.resolve.alias;
  alias["@"] = baseConfig.rootPath;

  // Use your ESLint 
  /*let eslintLoader = config.module.rules[0];
  eslintLoader.use[0].options.useEslintrc = true;*/

  // Add the stylus loader second-to-last
  // (last one must remain as the "file-loader")
  let loaderList = config.module.rules[1].oneOf;
  loaderList.splice(loaderList.length - 1, 0, {
    test: /\.styl$/,
    loader: ExtractTextPlugin.extract(
      Object.assign(
        {
          fallback: {
              loader: require.resolve('style-loader'),
              options: {
                hmr: false
              }
          },
          use: [
            {
              loader: require.resolve('css-loader'),
                options: {
                  importLoaders: 1,
                  minimize: true,
                  sourceMap: true
                }
github kubeless / kubeless-ui / config / webpack.config.js View on Github external
webpackConfig.module.rules.filter(rule => rule.loader && /css/.test(rule.loader)).forEach(rule => {
    const first = rule.loader
    const rest = rule.loader.slice(1)

    rule.loader = ExtractTextPlugin.extract({
      fallback: first,
      use: rest.join('!')
    })
    delete rule.loader
  })
github amireh / happypack / examples / extract-text-webpack-plugin / webpack.config.js View on Github external
function extract(options) {
  if (webpackVersion.match(/^1/)) {
    return ExtractTextPlugin.extract(options.fallback, options.use)
  }
  else {
    return ExtractTextPlugin.extract(options);
  }
}
github amireh / happypack / examples / extract-text-webpack-plugin / webpack.config--raw.js View on Github external
function extract(options) {
  if (webpackVersion.match(/^1/)) {
    return ExtractTextPlugin.extract(options.fallback, options.use)
  }
  else {
    return ExtractTextPlugin.extract(options);
  }
}
github scientifichackers / react-pages / react_pages / nodejs / config / custom-react-scripts / webpack-config / style-loader.js View on Github external
options: Object.assign({}, {sourceMap: shouldUseSourceMap}, options)
    });
  }

  if (isDev) {
    return {
      test,
      exclude,
      use: loaders
    };
  }

  return {
    test,
    exclude,
    loader: ExtractTextPlugin.extract(
      Object.assign(
        {
          fallback: require.resolve("style-loader"),
          use: loaders
        },
        extractTextPluginOptions
      )
    )
  };
};
github bleenco / abstruse / webpack.config.js View on Github external
function getProdStylesConfig() {
  return {
    plugins: [
      new extract('css/[hash].css')
    ],
    module: {
      rules: [
        { test: /\.css$/, use: extract.extract({ fallback: 'style-loader', use: 'css-loader' }), include: [root('src/app/styles')] },
        { test: /\.css$/, use: ['to-string-loader', 'css-loader'], exclude: [root('src/app/styles')] },
        { test: /\.scss$|\.sass$/, loader: extract.extract({ fallback: 'style-loader', use: ['css-loader', 'sass-loader'] }), exclude: [root('src/app/components'), root('node_modules')] },
        { test: /\.scss$|\.sass$/, use: ['to-string-loader', 'css-loader', 'sass-loader'], exclude: [root('src/app/styles')] }
      ]
    }
  };
}
github bleenco / abstruse / webpack / webpack.style.js View on Github external
function getProdStylesConfig() {
  return {
    plugins: [
      new extract('css/[name].css')
    ],
    module: {
      rules: [
        { test: /\.css$/, use: extract.extract({ fallback: 'style-loader', use: 'css-loader' }), include: [root('src/styles')] },
        { test: /\.css$/, use: ['to-string-loader', 'css-loader'], exclude: [root('src/styles')] },
        { test: /\.scss$|\.sass$/, loader: extract.extract({ fallback: 'style-loader', use: ['css-loader', 'sass-loader'] }), exclude: [root('src/app')] },
        { test: /\.scss$|\.sass$/, use: ['to-string-loader', 'css-loader', 'sass-loader'], exclude: [root('src/styles')] },
      ]
    }
  };
}
github bleenco / ngx-uploader / webpack.config.js View on Github external
function getProdStylesConfig() {
  return {
    plugins: [
      new extract('css/[name].css')
    ],
    module: {
      rules: [
        { test: /\.css$/, use: extract.extract({ fallback: 'style-loader', use: 'css-loader' }), include: [root('src/styles')] },
        { test: /\.css$/, use: ['to-string-loader', 'css-loader'], exclude: [root('src/styles')] },
        { test: /\.scss$|\.sass$/, loader: extract.extract({ fallback: 'style-loader', use: ['css-loader', 'sass-loader'] }), exclude: [root('src/app')] },
        { test: /\.scss$|\.sass$/, use: ['to-string-loader', 'css-loader', 'sass-loader'], exclude: [root('src/styles')] },
      ]
    }
  };
}
github bleenco / morose / webpack / webpack.style.js View on Github external
function getProdStylesConfig() {
  return {
    plugins: [
      new extract('css/[name].css')
    ],
    module: {
      rules: [
        { test: /\.css$/, use: extract.extract({ fallback: 'style-loader', use: 'css-loader' }), include: [root('src/app/styles')] },
        { test: /\.css$/, use: ['to-string-loader', 'css-loader'], exclude: [root('src/app/styles')] },
        { test: /\.scss$|\.sass$/, loader: extract.extract({ fallback: 'style-loader', use: ['css-loader', 'sass-loader'] }), exclude: [root('src/app/components')] },
        { test: /\.scss$|\.sass$/, use: ['to-string-loader', 'css-loader', 'sass-loader'], exclude: [root('src/app/styles')] },
      ]
    }
  };
}

extract-text-webpack-plugin

Extract text from bundle into a file.

MIT
Latest version published 6 years ago

Package Health Score

52 / 100
Full package analysis

Popular extract-text-webpack-plugin functions

Similar packages