Encountering a problem while bundling the vue-autonumeric
package with Webpack 2, where the dependency AutoNumeric
is not being found properly.
Although there is an alias set up in the configuration that works fine with webpack 3, it seems to fail when working on webpack 2 with a new project, showing this error message:
Hash: 470e79379d7394141898
Version: webpack 2.7.0
Time: 135ms
Asset Size Chunks Chunk Names
./dist/bundle.js 12.7 kB 0 [emitted] main
[0] ./~/vue-autonumeric/dist/vue-autonumeric.min.js 9.29 kB {0} [built]
[1] ./src/vueAutonumericTest.js 120 bytes {0} [built]
ERROR in ./~/vue-autonumeric/dist/vue-autonumeric.min.js
Module not found: Error: Can't resolve 'AutoNumeric' in '/home/user/vueAutonum/node_modules/vue-autonumeric/dist'
@ ./~/vue-autonumeric/dist/vue-autonumeric.min.js 1:82-104
@ ./src/vueAutonumericTest.js
Attempted to solve this by adding:
resolve: {
alias: {
AutoNumeric: 'node_modules/autonumeric/dist/autoNumeric.min',
},
},
to the webpack.config.js
file for webpack 2, but unfortunately, it did not work as expected.
Any insights on why this issue occurs and how to make it functional for both webpack version 3 and 2?
For more details on this problem, please refer to this Github issue.