Nuxt.js: error Unexpected module.exports, please use export default instead

Created on 13 Mar 2019  路  4Comments  路  Source: nuxt/nuxt.js

Version

v2.4.5

Reproduction link

https://nuxtjs.org/

Steps to reproduce

Simply run yarn create nuxt-app project and choose Eslint in the process.

What is expected ?

When I lint nuxt.config.js I do not want complaints about ES6 syntax

What is actually happening?

I get these errors when I try to lint nuxt.config.js:

1:29 error Unexpected require, please use import instead nuxt/no-cjs-in-config
2:13 error Unexpected require, please use import instead nuxt/no-cjs-in-config
4:1 error Unexpected module.exports, please use export default instead nuxt/no-cjs-in-config

Additional comments?

After the installation process is finished, I noticed that I get this warning message:

warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts.
$ eslint --ext .js,.vue --ignore-path .gitignore . --fix

package.json

{
"dependencies": {
    "@nuxtjs/axios": "^5.3.6",
    "cross-env": "^5.2.0",
    "nuxt": "^2.4.0",
    "vuetify": "^1.5.5",
    "vuetify-loader": "^1.2.1"
  },
  "devDependencies": {
    "@babel/plugin-syntax-dynamic-import": "^7.2.0",
    "@babel/preset-env": "^7.3.4",
    "@nuxtjs/eslint-config": "^0.0.1",
    "@vue/test-utils": "^1.0.0-beta.27",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^8.2.1",
    "babel-jest": "^24.1.0",
    "eslint": "^5.0.1",
    "eslint-config-standard": ">=12.0.0",
    "eslint-loader": "^2.0.0",
    "eslint-plugin-import": ">=2.14.0",
    "eslint-plugin-jest": ">=21.24.1",
    "eslint-plugin-node": ">=7.0.1",
    "eslint-plugin-nuxt": ">=0.4.2",
    "eslint-plugin-promise": ">=4.0.1",
    "eslint-plugin-standard": ">=4.0.0",
    "eslint-plugin-vue": "^5.0.0",
    "jest": "^24.1.0",
    "nodemon": "^1.18.9",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.2",
    "vue-jest": "^3.0.3"
  },
  "babel": {
    "presets": [
      "@babel/preset-env"
    ]
  },
  "plugins": [
    "syntax-dynamic-import"
  ]
}

No need for a reproducible link in this case, I think.
Billal Begueradj

This bug report is available on Nuxt community (#c8819)
bug-report

Most helpful comment

It has been fixed in https://github.com/nuxt/create-nuxt-app/pull/203
I'll publish a patch version today.

All 4 comments

@clarkdo @manniL @aldarund

It has been fixed in https://github.com/nuxt/create-nuxt-app/pull/203
I'll publish a patch version today.

[email protected] published

Thank you nice boys :heart:

Was this page helpful?
0 / 5 - 0 ratings