livescript-loader icon indicating copy to clipboard operation
livescript-loader copied to clipboard

Usage with Babel loader

Open ischenkodv opened this issue 9 years ago • 2 comments

I use LiveScript loader with babel loader this way:

{ test: /\.ls$/, loader: 'babel?presets[]=react,presets[]=es2015!livescript' },

This configuration throws an exception:

ERROR in ./client/web/public/app.ls
Module build failed: TypeError: /home/dima/myapp/client/web/public/app.ls: Cannot assign to read only property 'mappings' of {"version":3,"sources":["/home/dima/myapp/client/web/public/app.ls"],"names":[],"mappings":";AACA,QAAQ,wBAAD;AAGP,QAAQ,gBAAA;AACR,KAAM,CAAA,... etc.

The problem is that it includes source maps to the output and Babel fails to transpile it. In the end I fixed it by adding map option:

{ test: /\.ls$/, loader: 'babel?presets[]=react,presets[]=es2015!livescript?map=linked-src' },

Should the map=linked-src be default option? Or maybe some note should be added to README.

ischenkodv avatar Mar 02 '16 19:03 ischenkodv

+1, same issue here.

laurentpayot avatar Aug 07 '16 13:08 laurentpayot

And by the way adding the map=linked-src option did the trick for me. Thanks @ischenkodv 👍

laurentpayot avatar Aug 09 '16 08:08 laurentpayot