From d5de73efd2c33b48d2b7dcf4ebac4c80d4036eff Mon Sep 17 00:00:00 2001
From: Thomas Sileghem
Date: Wed, 25 Sep 2019 23:09:28 +0100
Subject: [PATCH] replace ExtractTextPlugin by MiniCssExtractPlugin
---
.travis.yml | 4 ++--
package.json | 2 +-
spec/plugin.spec.js | 17 +++++++++--------
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 4d1e10b..189519e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,11 +5,11 @@ node_js:
- '8.3.0'
env:
- - WEBPACK_VERSION=4 EXTRACT_PLUGIN_VERSION=next
+ - WEBPACK_VERSION=4
install:
- npm install
- - npm install webpack@$WEBPACK_VERSION extract-text-webpack-plugin@$EXTRACT_PLUGIN_VERSION || true
+ - npm install webpack@$WEBPACK_VERSION || true
script:
- npm test -- --forceExit
diff --git a/package.json b/package.json
index eb621f4..ccf6c59 100644
--- a/package.json
+++ b/package.json
@@ -19,10 +19,10 @@
"@svgr/webpack": "^4.3.3",
"codecov": "^3.6.1",
"css-loader": "^3.2.0",
- "extract-text-webpack-plugin": "4.0.0-beta.0",
"file-loader": "^4.2.0",
"jest": "^24.9.0",
"memory-fs": "^0.4.1",
+ "mini-css-extract-plugin": "^0.8.0",
"react": "^16.9.0",
"rimraf": "^3.0.0",
"style-loader": "^1.0.0",
diff --git a/spec/plugin.spec.js b/spec/plugin.spec.js
index 17b0628..4396060 100644
--- a/spec/plugin.spec.js
+++ b/spec/plugin.spec.js
@@ -3,7 +3,8 @@ var path = require('path');
var MemoryFileSystem = require('memory-fs');
var webpack = require('webpack');
var _ = require('lodash');
-var ExtractTextPlugin = require('extract-text-webpack-plugin');
+const MiniCssExtractPlugin = require('mini-css-extract-plugin');
+
var FakeCopyWebpackPlugin = require('./helpers/copy-plugin-mock');
var plugin = require('../index.js');
@@ -424,7 +425,7 @@ describe('ManifestPlugin', function() {
});
});
- describe('with ExtractTextPlugin', function() {
+ describe('with MiniCssExtractPlugin', function() {
it('works when extracting css into a seperate file', function(done) {
webpackCompile({
context: __dirname,
@@ -440,17 +441,17 @@ describe('ManifestPlugin', function() {
module: {
rules: [{
test: /\.css$/,
- use: ExtractTextPlugin.extract({
- fallback: 'style-loader',
- use: 'css-loader'
- })
+ use: [
+ MiniCssExtractPlugin.loader,
+ 'css-loader'
+ ]
}]
},
plugins: [
new plugin(),
- new ExtractTextPlugin({
+ new MiniCssExtractPlugin({
filename: '[name].css',
- allChunks: true
+ // allChunks: true
})
]
}, {}, function(manifest, stats) {