I
I
Ilya2018-12-03 20:47:08
Node.js
Ilya, 2018-12-03 20:47:08

Vue-hackernews: Module build failed: SyntaxError: Unexpected token?

macOS. Trying to run https://github.com/vuejs/vue-hackernews-2.0 (example for vue-server-renderer).
NodeJs version:

node -v
v10.14.1
npm -v
6.4.1

I install: I
npm install
run:
npm run dev
I get an error (on the "import" function):

./src/router/index.js
Module build failed: SyntaxError: Unexpected token (7:35)
5 |
6 | // route-level code splitting
> 7 | const createListView = id => () => import('../views/CreateListView').then(m => m.default(id))
| ^
8 | const ItemView = () => import('../views/ItemView.vue')
9 | const UserView = () => import('../views/UserView.vue')
10 |
BabelLoaderError: SyntaxError: Unexpected token (7:35)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Sedyshev, 2018-12-03
@greatilya

Check if .babelrc has this:

"plugins": [
    "syntax-dynamic-import"
  ]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question