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

Import Error Gulp/Webpack Task #255

Closed
AlexR1712 opened this issue Sep 6, 2017 · 3 comments
Closed

Import Error Gulp/Webpack Task #255

AlexR1712 opened this issue Sep 6, 2017 · 3 comments

Comments

@AlexR1712
Copy link

AlexR1712 commented Sep 6, 2017

Hello guys, I have the following error, when I try to import embedjs to my code and run gulp/webpack task not works, can anyone help me to for solve import error.

I'm using this line to import embedjs import EmbedJS from 'embed-js'; but get this:

`[10:37:01] Using gulpfile /var/www/html/domain.com/gulpfile.js
[10:37:01] Starting 'all'...
[10:37:01] Starting 'sass'...
[10:37:02] Finished 'sass' after 1.55 s
[10:37:02] Starting 'combine'...
[10:37:02] Finished 'combine' after 56 ms
[10:37:02] Starting 'webpack'...
[10:37:04] 
[10:37:04] Finished 'webpack' after 1.77 s
[10:37:04] Starting 'sass'...
[10:37:06] Finished 'sass' after 1.33 s
[10:37:06] Starting 'webpack'...
{ [Error: ./~/embed-js/src/index.js
Module parse failed: /var/www/html/domain.com/node_modules/embed-js/src/index.js Unexpected token (84:8)
You may need an appropriate loader to handle this file type.
|   }
| 
|   async render() {
|     const { input, target, inlineEmbed } = this.options
|     if (!isElementPresent(this.options)) {
 @ ./resources/assets/js/panel.js 12:0-31]
  message: './~/embed-js/src/index.js\nModule parse failed: /var/www/html/domain.com/node_modules/embed-js/src/index.js Unexpected token (84:8)\nYou may need an appropriate loader to handle this file type.\n|   }\n| \n|   async render() {\n|     const { input, target, inlineEmbed } = this.options\n|     if (!isElementPresent(this.options)) {\n @ ./resources/assets/js/panel.js 12:0-31',
  showStack: false,
  showProperties: true,
  plugin: 'webpack-stream',
  __safety: { toString: [Function: bound ] } }
`
@ritz078
Copy link
Owner

ritz078 commented Sep 6, 2017

Maybe its because you are importing a ES6 file without running it through babel. Try using

import EmbedJS from "embed-js/dist/index.js"

@AlexR1712
Copy link
Author

Thank you @ritz078 Now Its Working! 👍

@ritz078
Copy link
Owner

ritz078 commented Sep 6, 2017

Great.

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

2 participants