I am in the middle of transferring a project from an older version of Webpack and Vue.js to Vue cli 3, which is working well, except I am having trouble figuring out how to get an additional loader to work. The loader is 'webpack-modernizr-loader', which loads modernizr and allows me to check if a user's browser can do promises and other modern JavaScript features.
My old webpack.config.js
looks something like this:
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: './src/main.ts',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
},
module: {
rules: [
...
{
loader: 'webpack-modernizr-loader',
options: {
options: [
],
'feature-detects': [
'test/es6/promises',
'test/audio/webaudio',
'test/websockets'
]
},
test: /empty-alias-file\.js$/
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js',
modernizr$: path.resolve(__dirname, './empty-alias-file.js')
}
},
...
}
With Vue cli 3 I have a vue.congfig.js
file, and am unsure how to get the above translated into it. So far my most recent attempt looks like this:
var path = require('path')
module.exports = {
...
configureWebpack: {
module: {
rules: [
{
loader: 'webpack-modernizr-loader',
options: {
options: [
],
'feature-detects': [
'test/es6/promises',
'test/audio/webaudio',
'test/websockets'
]
},
test: /empty-alias-file\.js$/
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js',
modernizr$: path.resolve(__dirname, './empty-alias-file.js')
}
}
}
}
But that is not working. I would love a point in the right direction or an example of existing code that does something similar.
Thanks!