mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-19 12:04:02 +08:00
Chore: upgrade to webpack@4 (#14173)
* Chore: upgrade webpack@4 * Chore: upgrade to webpack@4 * Chore: add babel-preset-stage-2 * Chore: fix test case * Chore: upgrade webpack@4 * Docs: update docs * Docs: update docs * Chore: fix coveralls * Chore: update yarn.lock
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
||||
|
||||
const Components = require('../components.json');
|
||||
const config = require('./config');
|
||||
|
||||
const webpackConfig = {
|
||||
mode: 'production',
|
||||
entry: Components,
|
||||
output: {
|
||||
path: path.resolve(process.cwd(), './lib'),
|
||||
@@ -20,6 +21,13 @@ const webpackConfig = {
|
||||
modules: ['node_modules']
|
||||
},
|
||||
externals: config.externals,
|
||||
performance: {
|
||||
hints: false
|
||||
},
|
||||
stats: 'none',
|
||||
optimization: {
|
||||
minimize: false
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
@@ -32,13 +40,11 @@ const webpackConfig = {
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
preserveWhitespace: false
|
||||
compilerOptions: {
|
||||
preserveWhitespace: false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.json$/,
|
||||
loader: 'json-loader'
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
loaders: ['style-loader', 'css-loader', 'postcss-loader']
|
||||
@@ -48,27 +54,7 @@ const webpackConfig = {
|
||||
loaders: ['style-loader', 'css-loader', 'sass-loader']
|
||||
},
|
||||
{
|
||||
test: /\.html$/,
|
||||
loader: 'html-loader?minimize=false'
|
||||
},
|
||||
{
|
||||
test: /\.otf|ttf|woff2?|eot(\?\S*)?$/,
|
||||
loader: 'url-loader',
|
||||
query: {
|
||||
limit: 10000,
|
||||
name: path.posix.join('static', '[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.svg(\?\S*)?$/,
|
||||
loader: 'url-loader',
|
||||
query: {
|
||||
limit: 10000,
|
||||
name: path.posix.join('static', '[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(gif|png|jpe?g)(\?\S*)?$/,
|
||||
test: /\.(svg|otf|ttf|woff2?|eot|gif|png|jpe?g)(\?\S*)?$/,
|
||||
loader: 'url-loader',
|
||||
query: {
|
||||
limit: 10000,
|
||||
@@ -79,12 +65,7 @@ const webpackConfig = {
|
||||
},
|
||||
plugins: [
|
||||
new ProgressBarPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify('production')
|
||||
}),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true
|
||||
})
|
||||
new VueLoaderPlugin()
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user