-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvue.config.js
More file actions
62 lines (58 loc) · 1.67 KB
/
Copy pathvue.config.js
File metadata and controls
62 lines (58 loc) · 1.67 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 dotenv = require('dotenv')
const CopyPlugin = require('copy-webpack-plugin')
const path = require('path')
dotenv.config()
const publicRoot = process.env.PUBLIC_ROOT || '/generated/'
const outputDir = path.join(process.env.BREADBOARD_ROOT, publicRoot)
const plugins = []
// Copy all experiment files into the experiment directory
if (process.env.EXPERIMENT_ROOT) {
const expPath = path.join(process.env.BREADBOARD_ROOT, process.env.EXPERIMENT_ROOT)
console.log('copying breadboard files to', expPath)
plugins.push(
new CopyPlugin([{
from: '**',
to: expPath,
context: 'backend/',
transform (content, filePath) {
// content is a Buffer
// Add our public root to the client graph
if (path.basename(filePath) === 'client-graph.js') {
const isProd = process.env.NODE_ENV === 'production'
let s = content.toString()
s = s.replace(/__PUBLIC_ROOT__/g, publicRoot)
s = s.replace(/__DEV__/g, !isProd)
s = s.replace(/__PROD__/g, isProd)
return Buffer.from(s)
}
return content
},
}]),
)
}
// Copy all data files into a breadboard directory
if (process.env.DATA_ROOT) {
const dataDir = path.join(process.env.BREADBOARD_ROOT, process.env.DATA_ROOT)
console.log('copying data files to', dataDir)
plugins.push(
new CopyPlugin([{
from: '**',
to: dataDir,
context: 'data/',
}]),
)
}
module.exports = {
outputDir: outputDir || '../breadboard/generated',
publicPath: publicRoot,
transpileDependencies: [
'vuetify',
],
filenameHashing: false,
devServer: {
writeToDisk: true,
},
configureWebpack: {
plugins,
},
}