These are chat archives for canjs/canjs

17th
May 2016
Andrei Balmus
@abalmush
May 17 2016 10:58

Hi Guys, I’m getting an error in can@2.3.23/dist/cjs/component/component.js that process.js 404 (Not Found)

...
  module.exports = Component;
})(require('process'));

shouid I install some process module?

Matthew Phillips
@matthewp
May 17 2016 12:05
@abalmush I don't see that require in dist/cjs/component/component.js, you sure that's not your build tool adding that?
I think you're using jspm, it might be detecting process improperly
Andrei Balmus
@abalmush
May 17 2016 12:30

@matthewp yes I’m using JSPM it worked well before, remember we found how to install canjs with directory override?

jspm install can -o "{ directories: { lib: 'dist/cjs' }, main: 'can' }”

I didn’t have this issue with JSPM 0.15 but now I have JSPM 0.16 and it can’t find process module :(

Andrei Balmus
@abalmush
May 17 2016 12:36
Screen Shot 2016-05-17 at 3.36.01 PM.png
this how component.js looks for me
Matthew Phillips
@matthewp
May 17 2016 13:22
If you npm install it, you don't get that. I'm pretty sure jspm is doing some process detection and adding that require. The word "processor" does appear in that file, so maybe that's the cause.
Andrei Balmus
@abalmush
May 17 2016 13:44
ok let me try this, thanks Matt
Andrei Balmus
@abalmush
May 17 2016 15:41
OK I figure it out. CJS wont work with JSPM as it wrapping it with (function(process){...}(require(‘process'))). I used AMD format instead and it works pretty well with following overrides:
...
"overrides": {
      "npm:can@2.3.23": {
        "main": "can.js",
        "format": "amd",
        "directories": {
          "dist": "dist/amd",
          "lib": "can"
        },
        "map": {
          "can": "can/can",
          "jquery": "jquery"
        }
      }
    }
Bundling also works well
Matthew Phillips
@matthewp
May 17 2016 15:57
so jspm always does the require('process') thing for commonjs?
hm
i would think it would then install the process shim along with it
Andrei Balmus
@abalmush
May 17 2016 17:15
yes it always do that if it’s CommonJS style module, and it requires to install process
the example i have npm:buffer in jspm.config and it has process as a dependancy:
"npm:buffer@3.6.0": {
      "base64-js": "npm:base64-js@0.0.8",
      "child_process": "github:jspm/nodelibs-child_process@0.1.0",
      "fs": "github:jspm/nodelibs-fs@0.1.2",
      "ieee754": "npm:ieee754@1.1.6",
      "isarray": "npm:isarray@1.0.0",
      "process": "github:jspm/nodelibs-process@0.1.2"
    },