Extending vue-autonumeric with quasar webpack #8707
Answered
by
hawkeye64
phgrund
asked this question in
General - Components / Directives / etc
-
I’m trying to install VueAutonumeric but I’m having trouble to extend the webpack config. According to the documentation, I have to extend webpack like this module.exports = {
entry : './src/vueAutonumericTest.js',
output : {
filename: './dist/bundle.js'
},
resolve: {
alias: {
AutoNumeric: 'node_modules/autonumeric/dist/autoNumeric.min',
},
},
}; This is how I tried to extend extendWebpack (cfg) {
cfg.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /node_modules/
})
cfg.resolve.alias.AutoNumeric = 'node_modules/autonumeric/dist/autoNumeric.min'
} But it gives the following error ERROR Failed to compile with 1 errors 5:53:17 PM
This dependency was not found:
* AutoNumeric in ./node_modules/vue-autonumeric/dist/vue-autonumeric.min.js
To install it, you can run: npm install --save AutoNumeric How can I import this module? I have both of them in my node_modules |
Beta Was this translation helpful? Give feedback.
Answered by
hawkeye64
Mar 29, 2021
Replies: 1 comment 1 reply
-
@phgrund First of all, always use const path = require('path')
.
.
.
chainWebpack (chain) {
chain.plugin('eslint-webpack-plugin')
.use(ESLintPlugin, [{ extensions: ['js', 'vue'] }])
chain.resolve.alias.merge({
'AutoNumeric': path.resolve(__dirname, 'node_modules/vue-autonumeric/dist/vue-autonumeric.min.js')
})
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rstoenescu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@phgrund First of all, always use
path
to resolve the packages.Second, verify the file exists where you think it should be.
Third, use
chainWebpack
in quasar.conf.js instead, like this: