Add webpack alias

This commit is contained in:
Pig Fang 2018-08-20 21:39:27 +08:00
parent 98d228da4c
commit da8ac77ace
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import $ from 'jquery';
import sweetalert2 from 'sweetalert2/dist/sweetalert2.min';
import sweetalert2 from 'sweetalert2';
import { trans } from './i18n';
/**
@ -72,7 +72,6 @@ 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

@ -141,12 +141,20 @@ const config = {
output: {
comments: /^\**!|@preserve|@license|@cc_on/
}
}
},
exclude: [
/sweetalert2$/,
/node_modules.*jquery$/
]
})
]
},
resolve: {
extensions: ['.js', '.vue', '.json']
extensions: ['.js', '.vue', '.json'],
alias: {
jquery: 'jquery/dist/jquery.min.js',
sweetalert2$: 'sweetalert2/dist/sweetalert2.min.js',
},
},
devtool: devMode ? 'cheap-module-eval-source-map' : false,
stats: 'errors-only'