2018-07-29 15:31:54 +08:00
|
|
|
const VueLoaderPlugin = require('vue-loader/lib/plugin');
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
|
|
const WebpackBar = require('webpackbar');
|
|
|
|
|
|
|
|
const devMode = !process.argv.includes('-p');
|
|
|
|
|
2018-07-29 18:56:07 +08:00
|
|
|
module.exports = [{
|
2018-07-29 15:31:54 +08:00
|
|
|
entry: {
|
|
|
|
index: './resources/assets/src/index.js',
|
|
|
|
polyfill: './resources/assets/src/js/polyfill.js',
|
|
|
|
style: [
|
|
|
|
'bootstrap/dist/css/bootstrap.min.css',
|
|
|
|
'admin-lte/dist/css/AdminLTE.min.css',
|
|
|
|
'datatables.net-bs/css/dataTables.bootstrap.css',
|
|
|
|
'bootstrap-fileinput/css/fileinput.min.css',
|
|
|
|
'font-awesome/css/font-awesome.min.css',
|
|
|
|
'icheck/skins/square/blue.css',
|
|
|
|
'toastr/build/toastr.min.css',
|
|
|
|
]
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: __dirname + '/public',
|
|
|
|
filename: '[name].js',
|
|
|
|
chunkFilename: devMode
|
|
|
|
? '[id].js'
|
|
|
|
: '[id].[chunkhash:7].js'
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
cacheDirectory: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
|
|
|
loader: 'vue-loader'
|
|
|
|
},
|
|
|
|
{
|
2018-07-30 09:45:37 +08:00
|
|
|
test: /\.(css|styl(us)?)$/,
|
2018-07-29 15:31:54 +08:00
|
|
|
exclude: /node_modules/,
|
|
|
|
use: [
|
2018-07-30 09:45:37 +08:00
|
|
|
'vue-style-loader',
|
2018-07-29 15:31:54 +08:00
|
|
|
{ loader: 'css-loader', options: { importLoaders: 2 } },
|
|
|
|
'postcss-loader',
|
|
|
|
'stylus-loader'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /node_modules.*\.css$/,
|
|
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|gif|svg|woff2?|eot|ttf)$/,
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 8192
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
noParse: /^(vue|jquery)$/
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new VueLoaderPlugin(),
|
|
|
|
new WebpackBar(),
|
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
filename: '[name].css',
|
|
|
|
chunkFilename: '[id].css'
|
|
|
|
}),
|
|
|
|
new CopyWebpackPlugin([
|
|
|
|
{
|
|
|
|
from: 'node_modules/admin-lte/dist/css/skins/skin-*.min.css',
|
|
|
|
to: 'skins',
|
|
|
|
flatten: true
|
|
|
|
},
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.vue', '.json']
|
|
|
|
},
|
|
|
|
devtool: devMode ? 'cheap-module-eval-source-map' : false,
|
|
|
|
stats: 'errors-only'
|
2018-07-29 18:56:07 +08:00
|
|
|
}, {
|
|
|
|
entry: {
|
|
|
|
en: './resources/lang/en/front-end.yml',
|
|
|
|
zh_CN: './resources/lang/zh_CN/front-end.yml',
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: __dirname + '/public/langs/',
|
|
|
|
filename: '[name].js',
|
|
|
|
library: '__bs_i18n__'
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.yml$/,
|
|
|
|
use: [
|
|
|
|
'json-loader',
|
|
|
|
'yaml-loader'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
stats: 'errors-only'
|
|
|
|
}];
|