Mahammad
Mahammad

Reputation: 181

How can I use ES6 in vue.config.js?

import routes from "./src/router/routes";

module.exports = {
 // routes
}

can not use es6 module here, it gives an error:

import routes from "./src/router/routes";
       ^^^^^^

SyntaxError: Unexpected identifier

also require does not work, as routes are ES6 modules (have import statements)

const routes = require("./src/router/routes");

Upvotes: 3

Views: 1407

Answers (1)

Gabriel Willemann
Gabriel Willemann

Reputation: 1921

You must enable the ES6 Modules in NodeJs.

Check this links for enable:

ATTENTION: This resource is experimental

Upvotes: 1

Related Questions