-
Notifications
You must be signed in to change notification settings - Fork 4
Example web app config
Tomasz Pluskiewicz edited this page Nov 20, 2019
·
3 revisions
Here are some examples of setting up web frameworks to use @zazuko/rdf-vocabularies
package
Note that the config below will only affect a production build.
const webpack = require('webpack')
module.exports = {
chainWebpack: config => {
config.module
.rule('nq')
.test(/\.nq$/)
.use('raw-loader')
.loader('raw-loader')
.end()
config.plugin('prefetch').tap(options => {
options[0].fileBlacklist = options[0].fileBlacklist || []
options[0].fileBlacklist.push(/vocab-\w+$/)
return options
})
// plugin only present in production build. need to check
if (config.plugins.has('named-chunks')) {
config.plugin('named-chunks').tap(([defaultName]) => {
return [(chunk) => {
const vocabModule = [...chunk._modules]
.find(m => /rdf-vocabularies\/ontologies$/.test(m.context))
if (vocabModule && vocabModule.resource) {
const matchVocabName = vocabModule.resource.match(/(\w+)\.nq$/)
if (matchVocabName) {
return 'vocab-' + matchVocabName[1]
}
}
// use vue's default names for other chunks
return defaultName(chunk)
}]
})
}
}
}