These are chat archives for stealjs/steal

9th
Dec 2016
Julia Allyce
@julia-allyce
Dec 09 2016 16:02
hey is there anyway to force steal to transpile a specific file/module? I have a node file that is getting skipped because its uses require instead of import :(
Julia Allyce
@julia-allyce
Dec 09 2016 16:07
I know I saw an issue in gh about this somewhere but I can't find it now
Julia Allyce
@julia-allyce
Dec 09 2016 16:29
Ok I figured it out. You can add a translate function for the modules
Adam L Barrett
@BigAB
Dec 09 2016 16:31
@julia-allyce What do you mean "translate function"? Could you provide a code sample so I may learn from what you have done?
Julia Allyce
@julia-allyce
Dec 09 2016 16:32
Adam L Barrett
@BigAB
Dec 09 2016 16:32
Thanks!
Julia Allyce
@julia-allyce
Dec 09 2016 16:32
i still dont have it working...but its getting there 😂
stealTools.build({
  config: __dirname + "/package.json!npm",
  meta: {
    "moduleName": {
      "translate": function(load) { ...transpile here? }
    },
},{})
Matthew Phillips
@matthewp
Dec 09 2016 17:21
that might work
Julia Allyce
@julia-allyce
Dec 09 2016 17:58
yea...i have not been able to get it to work, yet.

my translate function looks like this:

function(load){
    var opts = {
        modules: 'amd',
        sourceMap: false
    };
    var src = Babel.transform(load.source, opts);
    return src.code;
  }

and the final file looks right, but I am getting this error:
Uncaught TypeError: Object.defineProperty called on non-object(…)

:/
Chasen Le Hara
@chasenlehara
Dec 09 2016 18:05
Hey Julia!
Is the error when the translate function runs or when you run your code?
Julia Allyce
@julia-allyce
Dec 09 2016 18:08
when I run my code. Its also coming from an unrelated module, but if I remove the module that I am translating everything runs/builds fine
Julia Allyce
@julia-allyce
Dec 09 2016 18:42
ok I figured it out. The module I am translating depends on D3 which needed to be mapped to the minified d3 file I am using.
the npm d3 package doesn't seem to play nice with steal
or I am (most likely) doing things wrong