V-calendar: Failed to compile. ./node_modules/v-calendar/lib/v-calendar.umd.min.js Module parse failed: Unexpected token

Created on 27 Oct 2020  路  25Comments  路  Source: nathanreyes/v-calendar

Failed to compile.

./node_modules/v-calendar/lib/v-calendar.umd.min.js
Module parse failed: Unexpected token (1:20648)
You may need an appropriate loader to handle this file type.
| (function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["v-calendar"]=e(require("vue")):t["v-calendar"]=e(t["Vue"])})("undefined"!==typeof self?self:this,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,

npm install v-calendar
There is an error after installation.

I don't know what the problem is.
I want to know the solution.

Most helpful comment

FYI - I downgraded to v1 and it does not have the same problem.

npm uninstall --save v-calendar
npm install --save v-calendar@1

All 25 comments

I have the same kind of problem.

Same here

Edit:

OS: MacOS 10.15.7
Node version: 12.16.0
Yarn version: 1.22.10

Same error but only Linux, macOS is work

Same, version 2.0+ just doesn't work at the moment

Same here

Tagging @nathanreyes, in case he missed this one. I had to rollback myself, due to this issue

Will definitely start looking into it. If anyone can edit their comment with what OS they're on, npm vs yarn...that would help out some. I see Linux for at least one person.

fail on linux, node 8

Same here

macOS Mojave 10.14
Node 6.14

I have the same kind of problem. ZZZ
MacOS 10.15.7

The minified code has an unsupported destructor operator ...
This is the reason of this issue

ERROR in ./node_modules/v-calendar/lib/v-calendar.umd.min.js
Module parse failed: Unexpected token (1:28639)
You may need an appropriate loader to handle this file type.

MacOS Big Sur 11.0.1 (20B29)
using npm

Configuring Babel for compiling the folder inside node_modules resolved this issue for me
I added these lines into Webpack config

      {
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modules/,

        // v-calendar has modern js features in compiled code
        // we need to transpile them via babel
        include: /node_modules\/v-calendar/,
      },

Configuring Babel for compiling the folder inside node_modules resolved this issue for me
I added these lines into Webpack config

Adding this rule to webpack.base.conf in section:

module: {
rules: [
...(config.dev.useEslint ? [createLintingRule()] : []),
{
test: /.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
include: /node_modules\/v-calendar/,
},
....

NOT resolves this problem (win 10, npm 6.14.4, node 12.18.0)

same problem, on win 10

same problem,i try to adding the rule in webpack.base.conf,but it doesn't work,(win 10, npm 6.14.8, node 14.15.1, vue 2.9.6)

npm install babel-plugin-transform-object-rest-spread -D
and set the .babelrc
"plugins": [ ["transform-object-rest-spread", { "useBuiltIns": true }] ]
and
set the webpack config
{ test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules\/(?!(v-calendar)\/).*/, }

or

exclude: [ // Use an object instead of a string { test: path.resolve(__dirname, 'node_modules'), // Exclude the following from the exclusion exclude: path.resolve(__dirname, 'node_modules/name-of-package') } ],

it works on me

@Leewonwoo could you please share some context - where to put these entries? E.g. what section in

.babelrc

which section please?

vue.config.js

    "configureWebpack": {
        module: {
            rules: [
                {
                    test: /\.jsx?$/, 
                    loader: 'babel-loader', 
                    exclude: /node_modules\/(?!(v-calendar)\/).*/,
                }
            ]
        }
    }

FYI - I downgraded to v1 and it does not have the same problem.

npm uninstall --save v-calendar
npm install --save v-calendar@1

@Leewonwoo could you please share some context - where to put these entries? E.g. what section in

.babelrc

which section please?

vue.config.js

    "configureWebpack": {
        module: {
            rules: [
                {
                    test: /\.jsx?$/, 
                    loader: 'babel-loader', 
                    exclude: /node_modules\/(?!(v-calendar)\/).*/,
                }
            ]
        }
    }

here is my .babelrc

{
 "presets": [
   ["env", { "modules": false }],
   "es2015",
   "stage-0"
 ],
 "plugins": [
   "syntax-dynamic-import",
   ["transform-object-rest-spread", { "useBuiltIns": true }]
 ]
}

and dependencies(package.json)

 "dependencies": {
    "apollo-boost": "^0.1.28",
    "apollo-cache-inmemory": "^1.6.5",
    "apollo-client": "^2.6.8",
    "apollo-link": "^1.2.13",
    "apollo-link-error": "^1.1.12",
    "apollo-link-http": "^1.5.16",
    "apollo-link-token-refresh": "^0.2.5",
    "apollo-link-ws": "^1.0.19",
    "apollo-upload-client": "^13.0.0",
    "apollo-utilities": "^1.3.3",
    "bootstrap-vue": "^2.20.1",
    "compression": "^1.7.1",
    "cross-env": "^5.1.1",
    "es6-promise": "^4.1.1",
    "express": "^4.16.2",
    "extract-text-webpack-plugin": "^3.0.2",
    "firebase": "^7.24.0",
    "isomorphic-unfetch": "^3.0.0",
    "lru-cache": "^4.1.1",
    "route-cache": "0.4.3",
    "serve-favicon": "^2.4.5",
    "socket.io-client": "^2.3.0",
    "stats": "^1.0.0",
    "v-calendar": "^2.1.1",
    "vue": "^2.5.22",
    "vue-analytics": "^5.22.1",
    "vue-apollo": "^3.0.0-beta.11",
    "vue-blu": "^0.1.9",
    "vue-content-loader": "^0.2.3",
    "vue-meta": "^2.3.3",
    "vue-resource": "^1.5.1",
    "vue-responsive": "^1.0.1",
    "vue-router": "^3.0.1",
    "vue-server-renderer": "^2.5.22",
    "vuex": "^3.0.1",
    "vuex-router-sync": "^5.0.0"
  },
  "devDependencies": {
    "@babel/plugin-transform-spread": "^7.12.1",
    "autoprefixer": "^7.1.6",
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.5",
    "babel-plugin-syntax-dynamic-import": "^6.18.0",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "chokidar": "^1.7.0",
    "css-loader": "^0.28.11",
    "file-loader": "^1.1.5",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "rimraf": "^2.6.2",
    "style-loader": "^2.0.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.1",
    "sw-precache-webpack-plugin": "^0.11.4",
    "url-loader": "^0.6.2",
    "vue-loader": "^15.3.0",
    "vue-style-loader": "^4.1.2",
    "vue-template-compiler": "^2.5.22",
    "webpack": "^3.8.1",
    "webpack-dev-middleware": "^1.12.0",
    "webpack-graphql-loader": "^1.0.2",
    "webpack-hot-middleware": "^2.20.0",
    "webpack-merge": "^4.2.1",
    "webpack-node-externals": "^1.7.2"
  }

FYI - I downgraded to v1 and it does not have the same problem.

npm uninstall --save v-calendar
npm install --save v-calendar@1

this worked for me !

I was able to get v2 working in laravel mix by installing:
npm install laravel-mix-transpile-node-modules --save-dev

then adding to webpack.mix.js:

let mix = require('laravel-mix');
require('laravel-mix-transpile-node-modules');
mix.transpileNodeModules(['v-calendar']);

So there is no proper fix for this issue ?

Same here,

Win10,
npm 6.14.6

So, really no solution since more than half an year? Looks like abandoned project..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

knagyorg picture knagyorg  路  4Comments

mika76 picture mika76  路  3Comments

thfontaine picture thfontaine  路  3Comments

redraw picture redraw  路  3Comments

garygreen picture garygreen  路  3Comments