glslify / babel-plugin-glslify

:tropical_fish: Babel transform for glslify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incompatibility with babel 7

rubeniskov opened this issue · comments

In babel 7 the property state.file.log is undefined and raises the following error

{ TypeError: .../src/WidgetWorkspace3DViewer.js: Cannot read property 'filename' of undefined
    at PluginPass.CallExpression (.../node_modules/babel-plugin-glslify/glslify-babel.js:183:39)
    at newFn (.../node_modules/@babel/traverse/lib/visitors.js:175:21)
    at NodePath._call (.../node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (.../node_modules/@babel/traverse/lib/path/context.js:42:17)
    at NodePath.visit (.../node_modules/@babel/traverse/lib/path/context.js:92:31)
    at TraversalContext.visitQueue (.../node_modules/@babel/traverse/lib/context.js:116:16)
    at TraversalContext.visitMultiple (.../node_modules/@babel/traverse/lib/context.js:83:17)
    at TraversalContext.visit (.../node_modules/@babel/traverse/lib/context.js:142:19)
    at Function.traverse.node (.../node_modules/@babel/traverse/lib/index.js:82:17)
    at NodePath.visit (.../node_modules/@babel/traverse/lib/path/context.js:99:18) code: 'BABEL_TRANSFORM_ERROR' }

from this lines:

var filename = state.file.log.filename

var filename = state.file.log.filename

some references:
babel/babel#7715
https://stackoverflow.com/questions/35857271/get-current-filename-in-babel-plugin

I will post a PR to fixed

Kind regards

any update?

Is this plugin dead?

Is this plugin dead?

it seems yes

Switched to babel-plugin-glsl.

It has this feature which is actually very useful.

@rubeniskov Thank's for the fix.
Before the PR is accepted, you can patch-package with those changes. Solved the issue for me.