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

Webpack: Module parse failed: Unexpected token (341:14) #21

Closed
leonardlin opened this issue May 2, 2020 · 3 comments
Closed

Webpack: Module parse failed: Unexpected token (341:14) #21

leonardlin opened this issue May 2, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@leonardlin
Copy link

leonardlin commented May 2, 2020

I'm tried to use the module with my vuejs project.

I get the error below:

./node_modules/vue-pivottable/src/PivottableUi.js
Module parse failed: Unexpected token (341:14)
You may need an appropriate loader to handle this file type.
| 	  : h(Pivottable, {
|             props: {
|               ...props,
|               tableMaxWidth: this.tableMaxWidth
|             }
 @ ./node_modules/vue-pivottable/src/index.js 2:0-44
 @ ./src/main.ts
 @ multi (webpack)-dev-server/client?http://0.0.0.0:8081 webpack/hot/dev-server ./src/main.ts

this is my loader?

{
        test: /\.js$/,
        use: utils.scriptLoaders(scriptLoadersOptions).js,
        include: [resolve('src'), resolve('test')]
},
@leonardlin
Copy link
Author

I'm not an export with modules and webpack etc.

but from what I read a module should include a transpiled version.

It seems that this module (downloaded via npm) still needs to be transpiled.

I did this to my loader

      {
        test: /\.js$/,
        use: utils.scriptLoaders(scriptLoadersOptions).js,
        include: [resolve('src'), resolve('test'), resolve('node_modules/vue-pivottable')]
      },

it compiles and loads now

@siscovisac
Copy link

siscovisac commented Aug 10, 2020

I have the same problem as you. In which part of your component do you add the code you mention. I've been looking for a solution for weeks, I appreciate your answer.

 {
        test: /\.js$/,
        use: utils.scriptLoaders(scriptLoadersOptions).js,
        include: [resolve('src'), resolve('test'), resolve('node_modules/vue-pivottable')]
},

?

@Seungwoo321 Seungwoo321 self-assigned this Oct 11, 2021
@Seungwoo321 Seungwoo321 added the documentation Improvements or additions to documentation label Oct 11, 2021
@Seungwoo321 Seungwoo321 removed their assignment Oct 16, 2021
@cbbdev
Copy link
Contributor

cbbdev commented Feb 18, 2022

Hello, Not sure if this issue was addressed at some point but while trying to use this library we run into errors when compiling. As it turns out not all Babel can compile the "spread" operator since is not yet part of the spec. We tried multiple Babel extensions, settings and plugins but none worked as expected the since it can all depend on the version of Babel, npm, node, framework, etc... and makes it even more complex for trial and error/debugging. We ended up forking this repo and replacing all the instances where the spread is used (with Object.assing) and that did the work (no need of any Babel plugins). It may be better this way up until some JS features are fully supported. Here is fork if anyone want to use it. https://github.com/carrollbradford/vue-pivottable

Seungwoo321 added a commit that referenced this issue Mar 8, 2022
@Seungwoo321 Seungwoo321 added bug Something isn't working and removed documentation Improvements or additions to documentation labels Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants