question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Unexpected token import" from npm modules

See original GitHub issue
Describe the issue / bug.

When I try to install some npm modules, like vue-good-table or vuejs-datatables and I import them the error is an “unexpected token import”.

How can I reproduce this problem?

For example we can use vue good table.

  1. npm install --save vue-good-table
  2. In router/index.js (it’s probably the wrong place). The error will appear in the console of DevTools:
import VueGoodTable from 'vue-good-table';

Vue.use(VueGoodTable);
Tell me about your development environment.
  • Node version: 8.0.0
  • NPM version: 5.0.3
  • Operating System: Ubuntu

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
zxc23commented, Jun 21, 2017

In your renderer config, have you whitelisted them like:

let whiteListedModules = ['vue', 'vue-good-table']
5reactions
danilopolanicommented, Jul 26, 2017

@0libre .electron-vue/webpack.renderer.config.js (L21)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js - SyntaxError: Unexpected token import - Stack Overflow
Node.js - SyntaxError: Unexpected token import · 4. Use transpiler like Babel to use import in Nodejs as it is not natively supported...
Read more >
SyntaxError:Unexpected token while importing npm module
These modules are scripted in typescript and packaged using yarn build (babel loader is used). We want to import one of the modules...
Read more >
Unexpected token import Node.js - Reactgo
In this tutorial, we are going to learn about how to resolve the unexpected token import error in Node.js. When we use es6...
Read more >
SyntaxError: Unexpected token import in Node.js | bobbyhadz
The "SyntaxError: Unexpected token import" occurs when we use the ES6 import syntax in a version of Node that doesn't support it. To...
Read more >
Error Unexpected token import in nodejs | Edureka Community
Unfortunately, Node.js doesn't support ES6's import yet. To accomplish what you're trying to do (import the Express module), this code should ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found