-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvue.config.js
102 lines (97 loc) · 2.99 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
const path = require('path')
const WebpackNotifierPlugin = require('webpack-notifier')
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin')
// Use your Roadiz App .env file
const envFile = require('dotenv').config({ path: '../../.env' })
module.exports = {
productionSourceMap: false,
runtimeCompiler: true,
publicPath: '/themes/BaseTheme/static/',
outputDir: 'static',
crossorigin: 'use-credentials',
transpileDependencies: [
'swiper',
'dom7',
'ssr-window'
],
devServer: {
host: '0.0.0.0',
disableHostCheck: true,
watchOptions: {
poll: true
},
proxy: {
'^': {
target: 'http://0.0.0.0:' + (envFile.parsed ? envFile.parsed.APP_PORT : '80'), // project url when launch with make dev-server
changeOrigin: true
}
}
},
css: {
sourceMap: true
},
configureWebpack: config => {
config.plugins.push(
new SpriteLoaderPlugin({
plainSprite: true,
spriteAttrs: {
id: 'svg-sprite'
}
})
)
config.plugins.push(
new WebpackNotifierPlugin({
title: 'BaseTheme',
alwaysNotify: true
})
)
config.module.rules.push({
test: /svg\/.*\.svg$/,
use: [{
loader: 'svg-sprite-loader',
options: {
extract: true,
spriteFilename: '../static/svg/sprite.svg',
symbolId: 'icon-[name]'
}
},
'svg-transform-loader',
{
loader: 'svgo-loader',
options: {
plugins: [
{ removeTitle: true },
{ convertColors: { shorthex: false } },
{ convertPathData: false }
]
}
}]
})
},
chainWebpack: config => {
if (config.plugins.has('prefetch')) {
config.plugin('prefetch').tap(options => {
options[0].fileBlacklist = options[0].fileBlacklist || []
options[0].fileBlacklist.push(/async-(.)+?/)
return options
})
}
config
.plugin('html')
.tap(args => {
args[0].filename = '../Resources/views/base.html.twig'
args[0].template = 'Resources/views/base_src.html.twig'
return args
})
config.resolve
.alias
.set('@', path.resolve(__dirname, 'app'))
.set('~', path.resolve(__dirname, 'app'))
.end()
const svgRule = config.module.rule('svg')
// clear all existing loaders.
// if you don't do this, the loader below will be appended to
// existing loaders of the rule.
svgRule.uses.clear()
}
}