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.

correct use / import

See original GitHub issue

I cloned the hackernews example app with SSRS and I’m trying to use this icons but something goes wrong

import 'vue-awesome/icons'
import Icon from 'vue-awesome/components/Icon.vue'

export default {
  components : {
    Icon
  },

thats how I try to import the icons

error during render : /
/home/examples/vue/hackernews/node_modules/vue-awesome/icons/index.js:1
(function (exports, require, module, __filename, __dirname) { import './500px'
                                                              ^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
dcrystaljcommented, Dec 14, 2017

I am using vue-cli. it is working in dev. but running vue jest i get

   ...widgets\node_modules\vue-awesome\icons\volume-up.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Icon from '../components/Icon.vue'
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import
1reaction
Justineocommented, Nov 7, 2017

For SSR you need to:

  1. Make sure the component code goes through babel-loader by modifying the exclude option.
  2. When using webpack-node-externals, whitelist vue-awesome to include it into the server bundle.

You can look into the example provided by @d1820 here: https://github.com/Justineo/vue-awesome/issues/65#issuecomment-337116728

Read more comments on GitHub >

github_iconTop Results From Across the Web

Import definition and meaning | Collins English Dictionary
1. transitive verb/intransitive verb. To import products or raw materials means to buy them from another country for use in your own country....
Read more >
Import Definition & Meaning - Merriam-Webster
The meaning of IMPORT is to bring from a foreign or external source. How to use import in a sentence.
Read more >
import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >
Import Definition & Meaning | Dictionary.com
Import definition, to bring in (merchandise, commodities, workers, etc.) from a foreign country for use, sale, processing, reexport, or services. See more.
Read more >
How to correctly use import in Node JS - Stack Overflow
What do I need to change to get import to work? I have 3 simple files in the same directory. package.json; main.js; Utility.js....
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