Skip to content

Commit

Permalink
[Build] use MiniCssExtractPlugin instead of ExtractTextPlugin (youzan…
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Apr 25, 2018
1 parent 7714065 commit 7bdce04
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 51 deletions.
25 changes: 11 additions & 14 deletions build/webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const isProduction = process.env.NODE_ENV === 'production';

Expand Down Expand Up @@ -41,25 +41,23 @@ module.exports = {
{
loader: 'vue-loader',
options: {
preserveWhitespace: false,
extractCSS: true
preserveWhitespace: false
}
}
]
},
{
test: /\.js$/,
exclude: /node_modules|vue-router\/|vue-loader\//,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: [
'css-loader',
'postcss-loader'
]
})
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader'
]
},
{
test: /\.md/,
Expand All @@ -69,7 +67,7 @@ module.exports = {
]
},
{
test: /\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/,
test: /\.(woff2?|eot|ttf|svg)(\?.*)?$/,
loader: 'url-loader'
}
]
Expand All @@ -88,9 +86,8 @@ module.exports = {
filename: 'examples.html',
inject: true
}),
new ExtractTextPlugin({
filename: isProduction ? '[name].[hash:8].css' : '[name].css',
allChunks: true
new MiniCssExtractPlugin({
filename: isProduction ? '[name].[hash:8].css' : '[name].css'
})
]
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"dependency-tree": "^6.1.0",
"eslint": "^4.19.1",
"eslint-plugin-vue": "^4.5.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"fast-vue-md-loader": "^1.0.3",
"gh-pages": "^1.0.0",
"html-webpack-plugin": "3.2.0",
Expand All @@ -93,6 +92,7 @@
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "3.0.0",
"lint-staged": "^7.0.4",
"mini-css-extract-plugin": "^0.4.0",
"mocha": "^5.1.1",
"postcss": "^6.0.21",
"postcss-calc": "^6.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/vant-css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
},
"license": "MIT",
"devDependencies": {
"autoprefixer": "^7.1.4",
"autoprefixer": "^8.3.0",
"gulp": "^3.9.1",
"gulp-clean-css": "^3.9.0",
"gulp-iconfont": "^9.0.2",
"gulp-iconfont-css": "^2.1.0",
"gulp-postcss": "^7.0.0",
"md5-file": "^3.2.3",
"md5-file": "^4.0.0",
"postcss-easy-import": "^3.0.0",
"precss": "^2.0.0"
}
Expand Down
51 changes: 17 additions & 34 deletions packages/vant-css/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ atob@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.0.tgz#ab2b150e51d7b122b9efc8d7340c06b6c41076bc"

autoprefixer@^7.1.4:
version "7.2.6"
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-7.2.6.tgz#256672f86f7c735da849c4f07d008abb056067dc"
autoprefixer@^8.3.0:
version "8.3.0"
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-8.3.0.tgz#22ac5151c3c8946bb8f75f337d5c5042c0ec6404"
dependencies:
browserslist "^2.11.3"
caniuse-lite "^1.0.30000805"
browserslist "^3.2.4"
caniuse-lite "^1.0.30000830"
normalize-range "^0.1.2"
num2fraction "^1.2.2"
postcss "^6.0.17"
postcss "^6.0.21"
postcss-value-parser "^3.2.3"

aws-sign2@~0.7.0:
Expand Down Expand Up @@ -264,27 +264,12 @@ braces@^2.3.1:
split-string "^3.0.2"
to-regex "^3.0.1"

browserslist@^2.11.3:
version "2.11.3"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-2.11.3.tgz#fe36167aed1bbcde4827ebfe71347a2cc70b99b2"
browserslist@^3.2.4:
version "3.2.5"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-3.2.5.tgz#aa46a5ea33b5330178f3c91cfd85e148fcb57080"
dependencies:
caniuse-lite "^1.0.30000792"
electron-to-chromium "^1.3.30"

buffer-alloc-unsafe@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-0.1.1.tgz#ffe1f67551dd055737de253337bfe853dfab1a6a"

buffer-alloc@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.1.0.tgz#05514d33bf1656d3540c684f65b1202e90eca303"
dependencies:
buffer-alloc-unsafe "^0.1.0"
buffer-fill "^0.1.0"

buffer-fill@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-0.1.1.tgz#76d825c4d6e50e06b7a31eb520c04d08cc235071"
caniuse-lite "^1.0.30000830"
electron-to-chromium "^1.3.42"

bufferstreams@^1.0.2, bufferstreams@^1.1.0:
version "1.1.3"
Expand Down Expand Up @@ -325,7 +310,7 @@ camelcase@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"

caniuse-lite@^1.0.30000792, caniuse-lite@^1.0.30000805:
caniuse-lite@^1.0.30000830:
version "1.0.30000830"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000830.tgz#cb96b8a2dd3cbfe04acea2af3c4e894249095328"

Expand Down Expand Up @@ -600,7 +585,7 @@ ecc-jsbn@~0.1.1:
dependencies:
jsbn "~0.1.0"

electron-to-chromium@^1.3.30:
electron-to-chromium@^1.3.42:
version "1.3.42"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.42.tgz#95c33bf01d0cc405556aec899fe61fd4d76ea0f9"

Expand Down Expand Up @@ -1706,11 +1691,9 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"

md5-file@^3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/md5-file/-/md5-file-3.2.3.tgz#f9bceb941eca2214a4c0727f5e700314e770f06f"
dependencies:
buffer-alloc "^1.1.0"
md5-file@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/md5-file/-/md5-file-4.0.0.tgz#f3f7ba1e2dd1144d5bf1de698d0e5f44a4409584"

meow@^3.3.0:
version "3.7.0"
Expand Down Expand Up @@ -2300,7 +2283,7 @@ postcss@^5.0.10, postcss@^5.0.4, postcss@^5.0.5:
source-map "^0.5.6"
supports-color "^3.2.3"

postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.11, postcss@^6.0.13, postcss@^6.0.14, postcss@^6.0.17, postcss@^6.0.18, postcss@^6.0.3, postcss@^6.0.9:
postcss@^6.0.0, postcss@^6.0.1, postcss@^6.0.11, postcss@^6.0.13, postcss@^6.0.14, postcss@^6.0.18, postcss@^6.0.21, postcss@^6.0.3, postcss@^6.0.9:
version "6.0.21"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.21.tgz#8265662694eddf9e9a5960db6da33c39e4cd069d"
dependencies:
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5696,6 +5696,13 @@ mimic-response@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.0.tgz#df3d3652a73fded6b9b0b24146e6fd052353458e"

mini-css-extract-plugin@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.0.tgz#ff3bf08bee96e618e177c16ca6131bfecef707f9"
dependencies:
loader-utils "^1.1.0"
webpack-sources "^1.1.0"

minimalistic-assert@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
Expand Down

0 comments on commit 7bdce04

Please sign in to comment.