Former-commit-id: 57424383590df6ac10d7c441098e16c31f7cff1a [formerly 491c2e4aa0fddd61f39cb879e9a953d40969ac0e] [formerly 57424383590df6ac10d7c441098e16c31f7cff1a [formerly 491c2e4aa0fddd61f39cb879e9a953d40969ac0e] [formerly 57424383590df6ac10d7c441098e16c31f7cff1a [formerly 491c2e4aa0fddd61f39cb879e9a953d40969ac0e] [formerly 491c2e4aa0fddd61f39cb879e9a953d40969ac0e [formerly 074d0a76168918e736973ea5caa315a1c2700ab2 [formerly e16c3f634a73cbfcc14d2c7e889220d769071da0]]]]] Former-commit-id: a97ea8612927180ae591ef7022c593e1c725cb20 Former-commit-id: 2a035bf971462a1f003bac5cbb6345e79869a953 Former-commit-id: 4fc0025144b2f70a8c7939934beb870fbfbc1bce [formerly ce26783e57c59a1237163a54c176d840d2976aca] Former-commit-id: e2019be83f67e22bd7a4330cf1dfc544e57e3e88 Former-commit-id: 80d2ff652ae9c2291451095f7c772aedaefa0ced Former-commit-id: 08577da4bb6d2ca67cb07fadcac2b63b1872f9dd Former-commit-id: 61fee4b6be26a14b5803c98a83bb3cd4f38f39a2 Former-commit-id: 44d02a765b61bed416e8e924e22c91251fbfcaff
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: './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'
|
|
}
|
|
}
|