2020-02-07 16:08:14 +01:00
|
|
|
const nodeExternals = require('webpack-node-externals')
|
2020-02-10 17:08:15 +01:00
|
|
|
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')
|
2020-02-07 19:55:39 +01:00
|
|
|
const fs = require('fs')
|
2020-02-07 16:08:14 +01:00
|
|
|
|
2020-02-08 00:03:10 +01: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 16:08:14 +01:00
|
|
|
module.exports = function (api) {
|
|
|
|
api.chainWebpack((config, { isServer }) => {
|
|
|
|
if (isServer) {
|
|
|
|
config.externals([
|
|
|
|
nodeExternals({
|
2021-01-24 15:39:16 +01:00
|
|
|
allowlist: [/^vuetify/]
|
2020-02-07 16:08:14 +01:00
|
|
|
})
|
|
|
|
])
|
|
|
|
}
|
|
|
|
})
|
2020-02-07 19:55:39 +01:00
|
|
|
|
2020-02-10 17:08:15 +01:00
|
|
|
api.configureWebpack({
|
|
|
|
plugins: [
|
|
|
|
new VuetifyLoaderPlugin()
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
2020-02-07 19:55:39 +01:00
|
|
|
api.loadSource(async actions => {
|
2020-02-08 00:03:10 +01:00
|
|
|
addJSONCollection(actions, "Team", "./content/team.json")
|
|
|
|
addJSONCollection(actions, "SocialNavbarElements", "./content/ui/navbar/social.json")
|
2020-02-08 16:59:15 +01:00
|
|
|
addJSONCollection(actions, "ExtraPagesInfo", "./content/extra_page_infos.json")
|
2020-02-07 19:55:39 +01:00
|
|
|
})
|
2020-02-07 16:08:14 +01:00
|
|
|
}
|