-
Notifications
You must be signed in to change notification settings - Fork 4
Example web app config
Tomasz Pluskiewicz edited this page Nov 19, 2019
·
3 revisions
Here are some examples of setting up web frameworks to use @zazuko/rdf-vocabularies
package
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+\.js$/)
return options
})
},
configureWebpack: {
plugins: [
new webpack.NamedChunksPlugin((chunk) => {
const vocabModule = [...chunk._modules].find(m => /rdf-vocabularies\/ontologies$/.test(m.context))
if (vocabModule) {
const matchVocabName = vocabModule.id.match(/(\w+)\.nq$/)
if (matchVocabName) {
return 'vocab-' + matchVocabName[1]
}
}
return chunk.name
})
]
}
}