Commit 2604c619 authored by hetech's avatar hetech Committed by Zhi Cun

Chore: speeding up webpack (#14484)

* remove unsed dev dependencies

* chore: use latest css loaders & fix error

* remove postcss-nesting

* chore: remove postcss-loader

* upgrade copy-webpack-plugin
parent 969fdd26
...@@ -2,7 +2,6 @@ var path = require('path'); ...@@ -2,7 +2,6 @@ var path = require('path');
var fs = require('fs'); var fs = require('fs');
var nodeExternals = require('webpack-node-externals'); var nodeExternals = require('webpack-node-externals');
var Components = require('../components.json'); var Components = require('../components.json');
var saladConfig = require('./salad.config.json');
var utilsList = fs.readdirSync(path.resolve(__dirname, '../src/utils')); var utilsList = fs.readdirSync(path.resolve(__dirname, '../src/utils'));
var mixinsList = fs.readdirSync(path.resolve(__dirname, '../src/mixins')); var mixinsList = fs.readdirSync(path.resolve(__dirname, '../src/mixins'));
...@@ -48,12 +47,3 @@ exports.vue = { ...@@ -48,12 +47,3 @@ exports.vue = {
}; };
exports.jsexclude = /node_modules|utils\/popper\.js|utils\/date.\js/; exports.jsexclude = /node_modules|utils\/popper\.js|utils\/date.\js/;
exports.postcss = function(webapck) {
saladConfig.features.partialImport = {
addDependencyTo: webapck
};
return [
require('postcss-salad')(saladConfig)
];
};
{
"browsers": ["ie > 8", "last 2 versions"],
"features": {
"bem": {
"shortcuts": {
"component": "b",
"modifier": "m",
"descendent": "e"
},
"separators": {
"descendent": "__",
"modifier": "--"
}
}
}
}
...@@ -52,11 +52,7 @@ module.exports = { ...@@ -52,11 +52,7 @@ module.exports = {
}, },
{ {
test: /\.css$/, test: /\.css$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader'] loaders: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'sass-loader']
}, },
{ {
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/, test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
......
...@@ -47,11 +47,7 @@ const webpackConfig = { ...@@ -47,11 +47,7 @@ const webpackConfig = {
}, },
{ {
test: /\.css$/, test: /\.css$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader'] loaders: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'sass-loader']
}, },
{ {
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/, test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
......
...@@ -35,7 +35,7 @@ module.exports = { ...@@ -35,7 +35,7 @@ module.exports = {
output: { output: {
comments: false comments: false
} }
}, }
}) })
] ]
}, },
...@@ -64,11 +64,7 @@ module.exports = { ...@@ -64,11 +64,7 @@ module.exports = {
}, },
{ {
test: /\.css$/, test: /\.css$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader'] loaders: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'sass-loader']
}, },
{ {
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/, test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
......
...@@ -84,16 +84,8 @@ const webpackConfig = { ...@@ -84,16 +84,8 @@ const webpackConfig = {
} }
}, },
{ {
test: /\.css$/, test: /\.(scss|css)$/,
loaders: [ use: [
isProd ? MiniCssExtractPlugin.loader : 'style-loader',
'css-loader',
'postcss-loader'
]
},
{
test: /\.scss$/,
loaders: [
isProd ? MiniCssExtractPlugin.loader : 'style-loader', isProd ? MiniCssExtractPlugin.loader : 'style-loader',
'css-loader', 'css-loader',
'sass-loader' 'sass-loader'
......
...@@ -22,7 +22,6 @@ const webpackConfig = { ...@@ -22,7 +22,6 @@ const webpackConfig = {
}), }),
modules: ['node_modules'] modules: ['node_modules']
}, },
devtool: '#inline-source-map',
module: { module: {
rules: [ rules: [
{ {
...@@ -42,7 +41,7 @@ const webpackConfig = { ...@@ -42,7 +41,7 @@ const webpackConfig = {
}, },
{ {
test: /\.css$/, test: /\.css$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader'] loaders: ['style-loader', 'css-loader']
}, },
{ {
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/, test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
......
...@@ -84,9 +84,3 @@ ...@@ -84,9 +84,3 @@
} }
}; };
</script> </script>
<style>
@import 'highlight.js/styles/color-brewer.css';
@import 'assets/styles/common.css';
@import 'assets/styles/fonts/style.css';
</style>
...@@ -14,7 +14,7 @@ html, body { ...@@ -14,7 +14,7 @@ html, body {
#app { #app {
height: 100%; height: 100%;
@when component { &.is-component {
overflow-y: hidden; overflow-y: hidden;
.main-cnt { .main-cnt {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
line-height: @height; line-height: 80px;
z-index: 100; z-index: 100;
position: relative; position: relative;
......
...@@ -127,7 +127,8 @@ ...@@ -127,7 +127,8 @@
.el-autocomplete-suggestion.my-autocomplete { .el-autocomplete-suggestion.my-autocomplete {
li { li {
line-height: normal; line-height: normal;
padding: 7px *; padding-top: 7px;
padding-bottom: 7px;
.name { .name {
text-overflow: ellipsis; text-overflow: ellipsis;
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
margin-left: 10px; margin-left: 10px;
height: 32px; height: 32px;
line-height: 30px; line-height: 30px;
padding: 0 *; padding-top: 0;
padding-bottom: 0;
} }
.input-new-tag { .input-new-tag {
width: 90px; width: 90px;
......
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
font-size: 28px; font-size: 28px;
color: #8c939d; color: #8c939d;
width: 178px; width: 178px;
height: @width; height: 178px;
line-height: @height; line-height: 178px;
text-align: center; text-align: center;
} }
.avatar { .avatar {
width: 178px; width: 178px;
height: @width; height: 178px;
display: block; display: block;
} }
} }
......
...@@ -127,7 +127,8 @@ ...@@ -127,7 +127,8 @@
.el-autocomplete-suggestion.my-autocomplete { .el-autocomplete-suggestion.my-autocomplete {
li { li {
line-height: normal; line-height: normal;
padding: 7px *; padding-top: 7px;
padding-bottom: 7px;
.name { .name {
text-overflow: ellipsis; text-overflow: ellipsis;
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
margin-left: 10px; margin-left: 10px;
height: 32px; height: 32px;
line-height: 30px; line-height: 30px;
padding: 0 *; padding-top: 0;
padding-bottom: 0;
} }
.input-new-tag { .input-new-tag {
width: 90px; width: 90px;
......
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
font-size: 28px; font-size: 28px;
color: #8c939d; color: #8c939d;
width: 178px; width: 178px;
height: @width; height: 178px;
line-height: @height; line-height: 178px;
text-align: center; text-align: center;
} }
.avatar { .avatar {
width: 178px; width: 178px;
height: @width; height: 178px;
display: block; display: block;
} }
} }
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
margin-left: 10px; margin-left: 10px;
height: 32px; height: 32px;
line-height: 30px; line-height: 30px;
padding: 0 *; padding-top: 0;
padding-bottom: 0;
} }
.input-new-tag { .input-new-tag {
width: 90px; width: 90px;
......
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
font-size: 28px; font-size: 28px;
color: #8c939d; color: #8c939d;
width: 178px; width: 178px;
height: @width; height: 178px;
line-height: @height; line-height: 178px;
text-align: center; text-align: center;
} }
.avatar { .avatar {
width: 178px; width: 178px;
height: @width; height: 178px;
display: block; display: block;
} }
} }
......
...@@ -158,7 +158,8 @@ ...@@ -158,7 +158,8 @@
.el-autocomplete-suggestion.my-autocomplete { .el-autocomplete-suggestion.my-autocomplete {
li { li {
line-height: normal; line-height: normal;
padding: 7px *; padding-top: 7px;
padding-bottom: 7px;
.name { .name {
text-overflow: ellipsis; text-overflow: ellipsis;
......
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
margin-left: 10px; margin-left: 10px;
height: 32px; height: 32px;
line-height: 30px; line-height: 30px;
padding: 0 *; padding-top: 0;
padding-bottom: 0;
} }
.input-new-tag { .input-new-tag {
width: 90px; width: 90px;
......
...@@ -26,13 +26,13 @@ ...@@ -26,13 +26,13 @@
font-size: 28px; font-size: 28px;
color: #8c939d; color: #8c939d;
width: 178px; width: 178px;
height: @width; height: 178px;
line-height: @height; line-height: 178px;
text-align: center; text-align: center;
} }
.avatar { .avatar {
width: 178px; width: 178px;
height: @width; height: 178px;
display: block; display: block;
} }
} }
......
...@@ -2,7 +2,6 @@ import Vue from 'vue'; ...@@ -2,7 +2,6 @@ import Vue from 'vue';
import entry from './app'; import entry from './app';
import VueRouter from 'vue-router'; import VueRouter from 'vue-router';
import Element from 'main/index.js'; import Element from 'main/index.js';
import 'packages/theme-chalk/src/index.scss';
import routes from './route.config'; import routes from './route.config';
import demoBlock from './components/demo-block'; import demoBlock from './components/demo-block';
import MainFooter from './components/footer'; import MainFooter from './components/footer';
...@@ -11,6 +10,11 @@ import SideNav from './components/side-nav'; ...@@ -11,6 +10,11 @@ import SideNav from './components/side-nav';
import FooterNav from './components/footer-nav'; import FooterNav from './components/footer-nav';
import title from './i18n/title'; import title from './i18n/title';
import 'packages/theme-chalk/src/index.scss';
import 'highlight.js/styles/color-brewer.css';
import './assets/styles/common.css';
import './assets/styles/fonts/style.css';
Vue.use(Element); Vue.use(Element);
Vue.use(VueRouter); Vue.use(VueRouter);
Vue.component('demo-block', demoBlock); Vue.component('demo-block', demoBlock);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
content: ''; content: '';
display: inline-block; display: inline-block;
width: 4px; width: 4px;
height: @width; height: 4px;
border-radius: 50%; border-radius: 50%;
vertical-align: middle; vertical-align: middle;
background-color: #5e6d82; background-color: #5e6d82;
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
height: 42px; height: 42px;
width: 190px; width: 190px;
display: inline-block; display: inline-block;
line-height: @height; line-height: 42px;
font-size: 14px; font-size: 14px;
background-color: #409EFF; background-color: #409EFF;
color: #fff; color: #fff;
......
...@@ -73,11 +73,11 @@ ...@@ -73,11 +73,11 @@
"chai": "^3.5.0", "chai": "^3.5.0",
"cheerio": "^0.18.0", "cheerio": "^0.18.0",
"chokidar": "^1.7.0", "chokidar": "^1.7.0",
"copy-webpack-plugin": "^4.5.2", "copy-webpack-plugin": "^5.0.0",
"coveralls": "^2.11.14", "coveralls": "^2.11.14",
"cp-cli": "^1.0.2", "cp-cli": "^1.0.2",
"cross-env": "^3.1.3", "cross-env": "^3.1.3",
"css-loader": "^0.28.7", "css-loader": "^2.1.0",
"es6-promise": "^4.0.5", "es6-promise": "^4.0.5",
"eslint": "4.14.0", "eslint": "4.14.0",
"eslint-config-elemefe": "0.1.1", "eslint-config-elemefe": "0.1.1",
...@@ -89,10 +89,8 @@ ...@@ -89,10 +89,8 @@
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-autoprefixer": "^4.0.0", "gulp-autoprefixer": "^4.0.0",
"gulp-cssmin": "^0.1.7", "gulp-cssmin": "^0.1.7",
"gulp-postcss": "^6.1.1", "gulp-sass": "^4.0.2",
"gulp-sass": "^3.1.0",
"highlight.js": "^9.3.0", "highlight.js": "^9.3.0",
"html-loader": "^0.5.1",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"json-loader": "^0.5.7", "json-loader": "^0.5.7",
"json-templater": "^1.0.4", "json-templater": "^1.0.4",
...@@ -109,19 +107,17 @@ ...@@ -109,19 +107,17 @@
"markdown-it-container": "^2.0.0", "markdown-it-container": "^2.0.0",
"mini-css-extract-plugin": "^0.4.1", "mini-css-extract-plugin": "^0.4.1",
"mocha": "^3.1.1", "mocha": "^3.1.1",
"node-sass": "^4.5.3", "node-sass": "^4.11.0",
"optimize-css-assets-webpack-plugin": "^5.0.1", "optimize-css-assets-webpack-plugin": "^5.0.1",
"perspective.js": "^1.0.0", "perspective.js": "^1.0.0",
"postcss": "^5.1.2", "postcss": "^7.0.14",
"postcss-loader": "^2.1.5",
"postcss-salad": "^2.0.1",
"progress-bar-webpack-plugin": "^1.11.0", "progress-bar-webpack-plugin": "^1.11.0",
"rimraf": "^2.5.4", "rimraf": "^2.5.4",
"sass-loader": "^6.0.6", "sass-loader": "^7.1.0",
"select-version-cli": "^0.0.2", "select-version-cli": "^0.0.2",
"sinon": "^1.17.6", "sinon": "^1.17.6",
"sinon-chai": "^2.8.0", "sinon-chai": "^2.8.0",
"style-loader": "^0.19.0", "style-loader": "^0.23.1",
"transliteration": "^1.1.11", "transliteration": "^1.1.11",
"uglifyjs-webpack-plugin": "^2.1.1", "uglifyjs-webpack-plugin": "^2.1.1",
"uppercamelcase": "^1.1.0", "uppercamelcase": "^1.1.0",
......
module.exports = {
plugins: {
'postcss-salad': {
browsers: ['ie > 8', 'last 2 versions'],
features: {
bem: {
shortcuts: {
component: 'b',
modifier: 'm',
descendent: 'e'
},
separators: {
descendent: '__',
modifier: '--'
}
}
}
}
}
};
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment