I'm happy to learn about this plugin as I need it for some work on getting custom elements V1 to work (without shadow DOM) across browsers.
I'm on Windows 10, Node v0.12.7, npm v4.1.1. I went forth with this environment to create the most vanilla setup in a new project. Devdependencies in my package.json:
"devDependencies": {
"babel-core": "^6.21.0",
"babel-preset-env": "^1.1.8",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2"
}
.babelrc file:
{
"plugins": [
"transform-custom-element-classes",
"transform-es2015-classes"
]
}
gulpfile.js:
var gulp = require("gulp");
var babel = require("gulp-babel");
gulp.task("default", function () {
return gulp.src("src/js/main.js")
.pipe(babel())
.pipe(gulp.dest("js"));
});
Running "gulp" in this basic setup leads to this blocking error:
const buildHelper = babelTemplate(`function CLASS() { return Reflect.construct
^
SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at W:\ce\node_modules\babel-core\lib\transformation\file\options\option-manager.js:174:20
at Array.map (native)
at Function.normalisePlugins (W:\ce\node_modules\babel-core\lib\transformation\file\options\option-manager.js:154:20)
The problem can be narrowed down to be caused by the transform-custom-element-classes plugin, because if I disable it in .babelrc, transpilation is succesful. The problem is also not related to the JS input file, since I get the same problem if I leave that totally blank.
Doing some digging around the web, sometimes these kind of errors can be caused by hidden characters copied in from another tool or web page, but I'm not seeing such hidden characters when I enable them in my IDE (Atom), so it's unlikely to be a cause.
I'm not sure the problem is due to Windows as a whole, or a specific combination in my setup. I did try to use the latest and most vanilla setup possible though.