I'm having an issue with parsing a recently added module "date-holidays" in my webpack project. I've updated to the latest version of babel-core and babel-loader without any success.
The error:
Module parse failed: Unexpected token (16:28)
You may need an appropriate loader to handle this file type.
| export class HolidayRule {
| constructor (ruleObj) {
| const { rule, fn, opts, ...other } = ruleObj
| Object.assign(this, { rule, ...other })
| }
@ ./node_modules/date-holidays-parser/src/index.js 2:0-32
@ ./node_modules/date-holidays/src/Holidays.js
@ ./node_modules/date-holidays/src/index.js
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/Modals/CalendarModal.vue
@ ./src/components/Modals/CalendarModal.vue
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/Modal.vue
@ ./src/components/Modal.vue
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
webpack.base.conf.js:
module: {
rules: [
...(config.dev.useEslint ? [createLintingRule()] : []),
{
test: /\.vue$/,
exclude: /node_modules/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
}
I've also tried adding the plugins @babel/plugin-proposal-object-rest-spread as well as @babel/plugin-transform-spread but that didn't work either.