2017-12-15 06:07:55 +00:00
|
|
|
'use strict'
|
|
|
|
const utils = require('./utils')
|
|
|
|
const config = require('../config')
|
|
|
|
const vueLoaderConfig = require('./vue-loader.conf')
|
2017-04-18 07:09:13 +00:00
|
|
|
|
2017-12-15 06:07:55 +00:00
|
|
|
const createLintingRule = () => ({
|
|
|
|
test: /\.(js|vue)$/,
|
|
|
|
loader: 'eslint-loader',
|
|
|
|
enforce: 'pre',
|
2018-03-26 05:22:16 +00:00
|
|
|
include: [utils.resolve('src'), utils.resolve('test')],
|
2017-12-15 06:07:55 +00:00
|
|
|
options: {
|
|
|
|
formatter: require('eslint-friendly-formatter'),
|
|
|
|
emitWarning: !config.dev.showEslintErrorsInOverlay
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2017-04-18 07:09:13 +00:00
|
|
|
module.exports = {
|
2018-03-26 05:22:16 +00:00
|
|
|
context: utils.resolve(''),
|
2017-08-07 08:11:10 +00:00
|
|
|
entry: {
|
2018-03-26 05:22:16 +00:00
|
|
|
app: utils.resolve('src/main.js')
|
2017-08-07 08:11:10 +00:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: config.build.assetsRoot,
|
|
|
|
filename: '[name].js',
|
2017-12-15 06:07:55 +00:00
|
|
|
publicPath: process.env.NODE_ENV === 'production'
|
|
|
|
? config.build.assetsPublicPath
|
|
|
|
: config.dev.assetsPublicPath
|
2017-08-07 08:11:10 +00:00
|
|
|
},
|
|
|
|
resolve: {
|
2018-03-26 05:22:16 +00:00
|
|
|
modules: [utils.resolve('node_modules')],
|
2017-08-07 08:11:10 +00:00
|
|
|
extensions: ['.js', '.vue', '.json'],
|
|
|
|
alias: {
|
2018-03-26 05:22:16 +00:00
|
|
|
'vue$': utils.resolve('node_modules/vue/dist/vue.esm.js'),
|
|
|
|
|
|
|
|
'vue-count-to': utils.resolve('node_modules/vue-count-to/dist/vue-count-to.min.js'),
|
|
|
|
'vue-hot-reload-api': utils.resolve('node_modules/vue-hot-reload-api/dist/index.js'),
|
|
|
|
'vue-i18n': utils.resolve('node_modules/vue-i18n/dist/vue-i18n.esm.js'),
|
|
|
|
'vue-loader': utils.resolve('node_modules/vue-loader/index.js'),
|
|
|
|
'vue-router': utils.resolve('node_modules/vue-router/dist/vue-router.esm.js'),
|
|
|
|
'vue-splitpane': utils.resolve('node_modules/vue-splitpane/dist/vue-split-pane.min.js'),
|
|
|
|
'vue-style-loader': utils.resolve('node_modules/vue-style-loader/index.js'),
|
|
|
|
'vue-template-compiler': utils.resolve('node_modules/vue-template-compiler/index.js'),
|
|
|
|
'vue-template-es2015-compiler': utils.resolve('node_modules/vue-template-es2015-compiler/index.js'),
|
|
|
|
'vuex': utils.resolve('node_modules/vuex/dist/vuex.esm.js'),
|
|
|
|
'xlsx': utils.resolve('node_modules/xlsx/xlsx.js'),
|
|
|
|
'screenfull': utils.resolve('node_modules/screenfull/dist/screenfull.js'),
|
|
|
|
'mockjs': utils.resolve('node_modules/mockjs/dist/mock-min.js'),
|
|
|
|
'jszip': utils.resolve('node_modules/jszip/dist/jszip.min.js'),
|
|
|
|
'js-cookie': utils.resolve('node_modules/js-cookie/src/js.cookie.js'),
|
|
|
|
'axios': utils.resolve('node_modules/axios/dist/axios.min.js'),
|
|
|
|
|
|
|
|
'@': utils.resolve('src'),
|
2017-08-07 08:11:10 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
2017-12-15 06:07:55 +00:00
|
|
|
...(config.dev.useEslint ? [createLintingRule()] : []),
|
2017-08-07 08:11:10 +00:00
|
|
|
{
|
|
|
|
test: /\.vue$/,
|
|
|
|
loader: 'vue-loader',
|
|
|
|
options: vueLoaderConfig
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader?cacheDirectory',
|
2018-03-26 05:22:16 +00:00
|
|
|
include: [utils.resolve('src'), utils.resolve('test'), utils.resolve('node_modules/webpack-dev-server/client')],
|
|
|
|
exclude: [utils.resolve('node_modules'), utils.resolve('src/vendor')],
|
2017-08-07 08:11:10 +00:00
|
|
|
},
|
2017-08-29 08:28:28 +00:00
|
|
|
{
|
|
|
|
test: /\.svg$/,
|
|
|
|
loader: 'svg-sprite-loader',
|
2018-03-26 05:22:16 +00:00
|
|
|
include: [utils.resolve('src/icons')],
|
2017-08-29 08:28:28 +00:00
|
|
|
options: {
|
|
|
|
symbolId: 'icon-[name]'
|
|
|
|
}
|
|
|
|
},
|
2017-08-07 08:11:10 +00:00
|
|
|
{
|
|
|
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
|
|
|
loader: 'url-loader',
|
2018-03-26 05:22:16 +00:00
|
|
|
exclude: [utils.resolve('src/icons')],
|
2017-09-08 07:37:13 +00:00
|
|
|
options: {
|
2017-08-07 08:11:10 +00:00
|
|
|
limit: 10000,
|
|
|
|
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
2017-04-18 07:09:13 +00:00
|
|
|
}
|
2017-08-07 08:11:10 +00:00
|
|
|
},
|
2017-12-15 06:07:55 +00:00
|
|
|
{
|
|
|
|
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
|
|
|
loader: 'url-loader',
|
|
|
|
options: {
|
|
|
|
limit: 10000,
|
|
|
|
name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
|
|
|
}
|
|
|
|
},
|
2017-08-07 08:11:10 +00:00
|
|
|
{
|
|
|
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
|
|
loader: 'url-loader',
|
2017-09-08 07:37:13 +00:00
|
|
|
options: {
|
2017-08-07 08:11:10 +00:00
|
|
|
limit: 10000,
|
|
|
|
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-12-15 06:07:55 +00:00
|
|
|
node: {
|
|
|
|
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
|
|
|
// source contains it (although only uses it if it's native).
|
|
|
|
setImmediate: false,
|
|
|
|
// prevent webpack from injecting mocks to Node native modules
|
|
|
|
// that does not make sense for the client
|
|
|
|
dgram: 'empty',
|
|
|
|
fs: 'empty',
|
|
|
|
net: 'empty',
|
|
|
|
tls: 'empty',
|
|
|
|
child_process: 'empty'
|
|
|
|
}
|
2017-04-18 07:09:13 +00:00
|
|
|
}
|