-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvue.config.js
More file actions
62 lines (59 loc) · 1.88 KB
/
vue.config.js
File metadata and controls
62 lines (59 loc) · 1.88 KB
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
const ZipWebpackPlugin = require('zip-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const isProduction = process.env.NODE_ENV === 'production';
const vueConfig = {
publicPath: isProduction ? '/media/mod_dfm_app' : '/dfm-app',
outputDir: isProduction ? 'mod_dfm_app' : 'dist',
assetsDir: isProduction ? 'assets' : './',
indexPath: isProduction ? 'tmpl/default.php' : 'index.html',
devServer: {
proxy: {
'index.php': {
target: 'http://www.enterergodics-test.com',
changeOrigin: true,
pathRewrite: {
},
},
},
},
css: {
sourceMap: true,
},
};
//set custom page to compile to Joomla Module
if (isProduction) {
vueConfig.pages = {
index: {
entry: 'src/main.js',
template: 'module/tmpl/default.ejs',
filename: 'tmpl/default.php',
title: 'Module template',
inject: false,
appMountId: 'app',
},
};
vueConfig.chainWebpack = config => {
if (isProduction) {
//copy module bootstrapping
config.plugin('copy').tap(args => {
args[0].patterns[0].from = 'module';
args[0].patterns[0].globOptions = {ignore: ['tmpl/default.ejs',],};
return args;
});
//copy images
config.plugin('copy-images').use(CopyWebpackPlugin, [{
patterns: [{
from: 'public/images',
to: 'assets/images',
},],
},]);
//create zip
config.plugin('zip-module').use(ZipWebpackPlugin, [{
path: '../dist',
filename: 'mod_dfm_app.zip',
pathPrefix: 'mod_dfm_app',
},]);
}
}
}
module.exports = vueConfig;