Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Tutorial: Module parse failed #2

Closed
caisah opened this issue Dec 22, 2015 · 4 comments
Closed

Tutorial: Module parse failed #2

caisah opened this issue Dec 22, 2015 · 4 comments

Comments

@caisah
Copy link

caisah commented Dec 22, 2015

Hi,
I have followed the tutorial, but when i try to build with
webpack ./client/app.js ./client/bundle.js --module-bind 'js=babel'
it fails with:

client/app.js Line 1: Unexpected token You may need an appropriate loader to handle this file type. | import greeting from './content'; | // We can use any ES6 syntax supported by Babel here now! | alert(${ greeting } and with ES6!!);

Do you know what the problem could be?

@arturoromeroslc
Copy link
Member

You could try removing the pipes before and after the import line import greeting from './content';, as that is not correct JS syntax.

@blakeembrey
Copy link

@caisah Have you tried loading a preset for Babel?

@arturoromerotcs I believe the pipes are from the CLI output of Babel, not in the actual code (you'll notice it's the start of every line.

@juaniiie
Copy link

@caisah, I encountered the same issue and fixed it by loading a preset for Babel. Thank you for the suggestion @blakeembrey !

These are the steps I took to fix the issue:

  1. Installed babel preset: npm install babel-preset-es2015 --save-dev
  2. Added a .babelrc file to the root directory with the following code: { "presets": ["es2015"] }

@caisah
Copy link
Author

caisah commented Jan 13, 2016

@juaniiie @blakeembrey Thanks!

@caisah caisah closed this as completed Jan 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants