forked from chasegiunta/craft-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
50 lines (48 loc) · 1.33 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
const path = require('path')
const ManifestPlugin = require('webpack-manifest-plugin')
config = {
https: false,
host: 'localhost',
port: 8080,
watchDir: 'templates'
}
module.exports = {
runtimeCompiler: true,
baseUrl: process.env.NODE_ENV === 'production'
? '/'
: `${config.https ? 'https' : 'http'}://${config.host}:${config.port}/`,
outputDir: 'web/dist',
filenameHashing: process.env.NODE_ENV === 'production' ? true : false,
css: {
sourceMap: true
},
devServer: {
// Uncommenting these will lose the 'Network' app access
// host: config.host,
// port: config.port,
https: config.https,
clientLogLevel: 'info',
headers: { 'Access-Control-Allow-Origin': '*' },
before(app, server) {
const sane = require('sane')
var watcher = sane(path.join(__dirname, config.watchDir), {glob: ['**/*']});
watcher.on('change', function (filepath, root, stat) {
console.log(' File saved:', filepath);
server.sockWrite(server.sockets, "content-changed");
});
}
},
configureWebpack: {
plugins: [
new ManifestPlugin({
publicPath: '/dist/'
})
]
},
// Disable building a useless index.html file
chainWebpack: config => {
config.plugins.delete('html')
config.plugins.delete('preload')
config.plugins.delete('prefetch')
}
}