Optimize webpack build

This commit is contained in:
Pig Fang 2018-08-04 10:22:16 +08:00
parent 9765122df4
commit 3c2aa37967
4 changed files with 19 additions and 4 deletions

View File

@ -58,6 +58,7 @@
"copy-webpack-plugin": "^4.5.2",
"css-loader": "^1.0.0",
"cssnano": "^4.0.4",
"csso-loader": "^0.3.1",
"eslint": "^5.2.0",
"eslint-formatter-beauty": "^3.0.0-beta.2",
"eslint-plugin-vue": "^5.0.0-beta.1",

View File

@ -1,5 +1,5 @@
import $ from 'jquery';
import sweetalert2 from 'sweetalert2';
import sweetalert2 from 'sweetalert2/dist/sweetalert2.min';
import { trans } from './i18n';
/**
@ -73,6 +73,7 @@ export function showModal(msg, title = 'Message', type = 'default', options = {}
}).modal(options);
}
/** @type {typeof import('sweetalert2').default} */
export const swal = sweetalert2.mixin({
confirmButtonText: trans('general.confirm'),
cancelButtonText: trans('general.cancel')

View File

@ -19,6 +19,7 @@ module.exports = [{
'font-awesome/css/font-awesome.min.css',
'icheck/skins/square/blue.css',
'toastr/build/toastr.min.css',
'sweetalert2/dist/sweetalert2.min.css',
'./resources/assets/src/stylus/common.styl',
]
},
@ -58,13 +59,18 @@ module.exports = [{
},
{
test: /node_modules.*\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader']
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { importLoaders: 1 } },
'csso-loader?-comments',
]
},
{
test: /common\.styl$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { importLoaders: 2 } },
{ loader: 'css-loader', options: { importLoaders: 3 } },
'csso-loader',
'postcss-loader',
'stylus-loader'
]

View File

@ -2472,7 +2472,14 @@ cssnano@^4.0.4:
is-resolvable "^1.0.0"
postcss "^6.0.0"
csso@^3.5.0:
csso-loader@^0.3.1:
version "0.3.1"
resolved "https://registry.npmjs.org/csso-loader/-/csso-loader-0.3.1.tgz#2401a8c825a079ec243e2654e355562201a8a6d4"
dependencies:
csso "^3.0.1"
loader-utils "^1.1.0"
csso@^3.0.1, csso@^3.5.0:
version "3.5.1"
resolved "https://registry.yarnpkg.com/csso/-/csso-3.5.1.tgz#7b9eb8be61628973c1b261e169d2f024008e758b"
dependencies: