I am having this weird error on a nuxt.js project that used to work, the thing is that after a fresh npm install && npm run dev
I get:
SyntaxError: Unexpected token )
at Function (<anonymous>)
at /home/user/Documents/project/frontend/src/node_modules/lodash/lodash.js:14866:16
The referenced line is this one:
14865: var result = attempt(function() {
14866: return Function(importsKeys, sourceURL + 'return ' + source)
14867: .apply(undefined, importsValues);
14868: });
I see nothing wrong. I suspect it's a webpack or a loader issue, but I just can't workout exactly what. I have tried to shrinkwrap webpack
and lodash
to the previous major versions, but the result is the same (reverting lodash actually makes everything worse). This is the package.json:
{
"name": "frontend",
"version": "0.1.1",
"description": "Nuxt.js project",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"precommit": "npm run lint"
},
"dependencies": {
"@fortawesome/fontawesome-free": "5.5.0",
"@mdi/font": "2.6.95",
"@nuxtjs/apollo": "3.0.7",
"@nuxtjs/axios": "5.3.1",
"ajv": "6.5.2",
"apollo-cache-inmemory": "1.2.6",
"apollo-client": "2.3.7",
"apollo-link": "1.2.2",
"apollo-link-context": "1.0.9",
"apollo-link-error": "1.1.1",
"apollo-link-http": "1.5.4",
"graphql": "0.13.2",
"graphql-tag": "2.9.2",
"jwt-decode": "2.2.0",
"nuxt": "1.4.4",
"qrious": "4.0.2",
"stylus": "0.54.5",
"vue-apollo": "3.0.0-beta.19",
"vue-i18n": "8.0.0",
"vuejs-logger": "1.5.3",
"vuetify": "1.3.9",
"vuex-pathify": "1.1.3",
"vuex-persistedstate": "2.5.4"
},
"devDependencies": {
"babel-eslint": "8.2.1",
"css-loader": "1.0.0",
"eslint": "4.15.0",
"eslint-friendly-formatter": "3.0.0",
"eslint-loader": "1.7.1",
"eslint-plugin-vue": "4.0.0",
"node-sass": "4.9.2",
"pug": "2.0.3",
"pug-plain-loader": "1.0.0",
"sass-loader": "7.0.3",
"style-loader": "0.21.0",
"stylus-loader": "3.0.2"
}
}
And this is the npm-shrinkwrap
I tried with (same with lodash):
{
"name": "frontend",
"version": "0.1.1",
"lockfileVersion": 1,
"dependencies": {
"webpack": {
"version": "3.11.0",
"from": "webpack@3.11.0"
}
}
}
Is this a bug in nuxt, webpack or lodash? Is it even a bug?