From 592e1d4f9b91ced5297ce6630aaff136dcf5fd21 Mon Sep 17 00:00:00 2001 From: Kayo Phoenix Date: Mon, 20 Feb 2017 15:54:16 +0500 Subject: [PATCH] Updated extract-text-webpack-plugin definition --- .../extract-text-webpack-plugin-tests.ts | 27 ++++++++++--------- extract-text-webpack-plugin/index.d.ts | 12 ++++----- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts b/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts index 63177ebde3..ca992ea3ef 100644 --- a/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts +++ b/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts @@ -22,18 +22,18 @@ configuration = { // Extract css files { test: /\.css$/, - loader: ExtractTextPlugin.extract({ - fallbackLoader: "style-loader", - loader: "css-loader", + use: ExtractTextPlugin.extract({ + fallback: "style-loader", + use: "css-loader", }) }, // Optionally extract less files // or any other compile-to-css language { test: /\.less$/, - loader: ExtractTextPlugin.extract({ - fallbackLoader: "style-loader", - loader: ["css-loader", "less-loader"], + use: ExtractTextPlugin.extract({ + fallback: "style-loader", + use: ["css-loader", "less-loader"], }) } // You could also use other loaders the same way. I. e. the autoprefixer-loader @@ -70,10 +70,13 @@ configuration = { // ... module: { rules: [ - { test: /\.css$/, loader: ExtractTextPlugin.extract({ - fallbackLoader: "style-loader", - loader: "css-loader" - }) } + { + test: /\.css$/, + use: ExtractTextPlugin.extract({ + fallback: "style-loader", + use: "css-loader" + }) + } ] }, plugins: [ @@ -89,8 +92,8 @@ configuration = { // ... module: { rules: [ - { test: /\.scss$/i, loader: extractCSS.extract(['css','sass']) }, - { test: /\.less$/i, loader: extractLESS.extract(['css','less']) }, + { test: /\.scss$/i, use: extractCSS.extract(['css','sass']) }, + { test: /\.less$/i, use: extractLESS.extract(['css','less']) }, ] }, plugins: [ diff --git a/extract-text-webpack-plugin/index.d.ts b/extract-text-webpack-plugin/index.d.ts index 21052b08c1..6da0c183c3 100644 --- a/extract-text-webpack-plugin/index.d.ts +++ b/extract-text-webpack-plugin/index.d.ts @@ -1,15 +1,15 @@ // Type definitions for extract-text-webpack-plugin 2.0.0 -// Project: https://github.com/webpack/extract-text-webpack-plugin -// Definitions by: flying-sheep +// Project: https://github.com/webpack-contrib/extract-text-webpack-plugin +// Definitions by: flying-sheep , kayo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { Plugin, OldLoader } from 'webpack' +import { Plugin, OldLoader, NewLoader } from 'webpack' /** * extract-text-webpack-plugin has no support for .options instead of .query yet. * See https://github.com/webpack/extract-text-webpack-plugin/issues/281 */ -type Loader = string | OldLoader +type Loader = string | OldLoader | NewLoader interface ExtractPluginOptions { /** the filename of the result file. May contain `[name]`, `[id]` and `[contenthash]` */ @@ -24,9 +24,9 @@ interface ExtractPluginOptions { interface ExtractOptions { /** the loader(s) that should be used for converting the resource to a css exporting module */ - loader: Loader | Loader[] + use: Loader | Loader[] /** the loader(s) that should be used when the css is not extracted (i.e. in an additional chunk when `allChunks: false`) */ - fallbackLoader?: Loader | Loader[] + fallback?: Loader | Loader[] /** override the `publicPath` setting for this loader */ publicPath?: string }