Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module parse failed: Unexpected token #78

Closed
mykone opened this issue Mar 14, 2019 · 5 comments
Closed

Module parse failed: Unexpected token #78

mykone opened this issue Mar 14, 2019 · 5 comments

Comments

@mykone
Copy link

mykone commented Mar 14, 2019

Hello, thanks for creating this component, but I am unable to get it working in my setup. Here's my exception:

Failed to compile.
Module parse failed: Unexpected token (13:12)
You may need an appropriate loader to handle this file type.
|             staticStyle,
|             attrs = {},
|             ...rest
|           } = data;

Here's my usage:

import GearsIcon from 'icons/settings.svg';

Here's my Webpack Config

//Inside webpack.parts.js
exports.loadImages = ({ include, exclude, options } = {}) => ({
  module: {
    rules: [
      {
        test: /\.(png|jpg|svg)$/,

        include,
        exclude,

        use: {
          loader: 'url-loader',
          options
        }
      }
    ]
  }
})

exports.loadSvgIcon = ({ include, exclude, options } = {}) => ({
  module: {
    rules: [
      {
        test: /\.svg$/,

        include,
        exclude,

        use: {
          loader: 'vue-svg-loader',
          options
        }
      }
    ]
  }
});

//Inside main webpack.config.js file
parts.loadSvgIcon({ include: [paths.app + '/icons'] }),
parts.loadImages({ include: [paths.admin, paths.app], exclude: [paths.app + '/icons'] }),

I'm not sure what I am doing wrong, it seems as if the loader is loading, but maybe another loader ins interfering with the string output of the loader. I am using Vue 2.6.9

Any help would be great. Thanks a lot.

@mykone
Copy link
Author

mykone commented Mar 14, 2019

Seems to be a loader issue for sure.. I used svg-to-vue-component and it works fine.

@thomasaull
Copy link

thomasaull commented Mar 21, 2019

I got the same error in Safari 10.1. I could provide a Test Repo if it helps

@b12k
Copy link

b12k commented Mar 29, 2019

Same issue in Edge and IE11.
SCRIPT1028: SCRIPT1028: Expected identifier, string or number
Looks like it is related to spread operator.
Which is not getting transpiled.

@andrey-hohlov
Copy link

solution #63 (comment)

@exeptionerror
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants