2020-02-07 15:08:14 +00:00
|
|
|
const nodeExternals = require('webpack-node-externals')
|
2020-02-07 18:55:39 +00:00
|
|
|
const fs = require('fs')
|
2020-02-07 15:08:14 +00:00
|
|
|
|
2020-02-07 23:03:10 +00:00
|
|
|
function addJSONCollection(actions,typeName, path) {
|
|
|
|
const list = JSON.parse(fs.readFileSync(path));
|
|
|
|
const collection = actions.addCollection({
|
|
|
|
typeName: typeName
|
|
|
|
})
|
|
|
|
|
|
|
|
for (const element of list) {
|
|
|
|
collection.addNode(element)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-07 15:08:14 +00:00
|
|
|
module.exports = function (api) {
|
|
|
|
api.chainWebpack((config, { isServer }) => {
|
|
|
|
if (isServer) {
|
|
|
|
config.externals([
|
|
|
|
nodeExternals({
|
|
|
|
whitelist: [/^vuetify/]
|
|
|
|
})
|
|
|
|
])
|
|
|
|
}
|
|
|
|
})
|
2020-02-07 18:55:39 +00:00
|
|
|
|
|
|
|
api.loadSource(async actions => {
|
2020-02-07 23:03:10 +00:00
|
|
|
addJSONCollection(actions, "Team", "./content/team.json")
|
|
|
|
addJSONCollection(actions, "SocialNavbarElements", "./content/ui/navbar/social.json")
|
2020-02-07 18:55:39 +00:00
|
|
|
})
|
2020-02-07 15:08:14 +00:00
|
|
|
}
|