Former-commit-id: 8bcf1b96e00fbb92330295f10e43422700755fdf [formerly 8bcf1b96e00fbb92330295f10e43422700755fdf [formerly 8bcf1b96e00fbb92330295f10e43422700755fdf [formerly 8bcf1b96e00fbb92330295f10e43422700755fdf [formerly 891f2243f4b3411c9ac5c45d8bfd05ca111e5ccf [formerly 4c0df3b606ce6539ec2e522db5a48822bb9ea5ec]]]]] Former-commit-id: b7f72e4ceef4bca10dcef08705bc85cdc8164763 Former-commit-id: 9b43bf6034000fca8fe57da259093c96775c31bc Former-commit-id: 3a0028ec0da10e8e9956ef21cc3c1f10a496245e [formerly a12422e41516f7c4278af232fc16ad40ba345d7b] Former-commit-id: 6145ec11e2615bbc3415d72728ea8dba87701b4e Former-commit-id: a6069fba783bf4a5153ddd9f96e879950483a626 Former-commit-id: c2e5ac5588bdc9e9aaf146410b59bfc4e355c6a6 Former-commit-id: 7a2a77e9c25c886b990dcf850a1f08f358bade1d Former-commit-id: f6dc949a4e3eb765925e22653a5e42d2a460c9ca
115 lines
2.8 KiB
JavaScript
Executable File
115 lines
2.8 KiB
JavaScript
Executable File
'use strict'
|
|
const path = require('path')
|
|
const utils = require('./utils')
|
|
const webpack = require('webpack')
|
|
const config = require('../config')
|
|
const vueLoaderConfig = require('./vue-loader.conf')
|
|
|
|
function resolve (dir) {
|
|
return path.join(__dirname, '..', dir)
|
|
}
|
|
|
|
const createLintingRule = () => ({
|
|
test: /\.(js|vue)$/,
|
|
loader: 'eslint-loader',
|
|
enforce: 'pre',
|
|
include: [resolve('src'), resolve('test')],
|
|
options: {
|
|
formatter: require('eslint-friendly-formatter'),
|
|
emitWarning: !config.dev.showEslintErrorsInOverlay
|
|
}
|
|
})
|
|
|
|
module.exports = {
|
|
context: path.resolve(__dirname, '../'),
|
|
entry: {
|
|
app: ['babel-polyfill', './src/main.js']
|
|
},
|
|
output: {
|
|
path: config.build.assetsRoot,
|
|
filename: '[name].js',
|
|
publicPath: process.env.NODE_ENV === 'production'
|
|
? config.build.assetsPublicPath
|
|
: config.dev.assetsPublicPath
|
|
},
|
|
resolve: {
|
|
extensions: ['.js', '.vue', '.json'],
|
|
alias: {
|
|
'vue$': 'vue/dist/vue.esm.js',
|
|
'@': resolve('src'),
|
|
}
|
|
},
|
|
module: {
|
|
rules: [
|
|
...(config.dev.useEslint ? [createLintingRule()] : []),
|
|
{
|
|
test: /\.vue$/,
|
|
loader: 'vue-loader',
|
|
options: vueLoaderConfig
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
loader: 'babel-loader',
|
|
include: [resolve('src'), resolve('test')]
|
|
},
|
|
{
|
|
test: /\.svg$/,
|
|
loader: 'svg-sprite-loader',
|
|
include: [resolve('src/assets/icons/svg')],
|
|
options: {
|
|
symbolId: 'd2-[name]'
|
|
}
|
|
},
|
|
{
|
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
|
loader: 'url-loader',
|
|
exclude: [resolve('src/assets/icons/svg')],
|
|
options: {
|
|
limit: 10000,
|
|
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
|
}
|
|
},
|
|
{
|
|
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
|
loader: 'url-loader',
|
|
options: {
|
|
limit: 10000,
|
|
name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
|
}
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
loaders: ["style", "css", "sass"]
|
|
},
|
|
{
|
|
test: /\.less$/,
|
|
loaders: ["style", "css", "less"]
|
|
},
|
|
{
|
|
test: /\.md$/,
|
|
loaders: ["text-loader"]
|
|
},
|
|
{
|
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
loader: 'url-loader',
|
|
options: {
|
|
limit: 10000,
|
|
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
|
}
|
|
}
|
|
]
|
|
},
|
|
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'
|
|
}
|
|
}
|