I am trying to use the Javascript ES6 import/export functionality in my Codepen project, and I thought it was supported based on some articles I read, but I am having trouble getting it to work. I have set my Codepen project to use Webpack and Babel to process my javascript file, and even tried using Chrome Canary to see if that would support ES6 (to no avail).
In my Codepen project, I wrote a basic example exporting a string variable from one file:
//data.js
export let firstName = 'George';
Then importing it into my primary javascript file to log in the console:
//index.js
import firstName from "./data";
console.log(FirstName);
Unfortunately, the Chrome console is reporting the error:
Uncaught VM3034 index.js:1
SyntaxError: Unexpected token import
Does anyone know how to get this to work, if possible? I even found another example of a Codepen project using ES6 import/export successfully, but I'm not sure what I'm doing differently to get the error. Any help would be much appreciated.