Details

    • Similar Issues:
    • Sprint:
      1.0-b05/b-06

      Description

      Keith has been looking at the problems with browserify and developing on windows (result of hack fest).

      Issue here is that browserify fails to find modules when built on windows. I'm pretty sure it has to do with windows paths, we have a setting for 'full paths' instead of relative ones, which may also be contributing to it.

        Attachments

          Activity

          Hide
          tfennelly Tom FENNELLY added a comment -

          I'd need to grab a windows machine and try it. Looks like a paths issue while trying to exec the mvnbuild script.

          Everyone should just use Linux/MacOS

          Show
          tfennelly Tom FENNELLY added a comment - I'd need to grab a windows machine and try it. Looks like a paths issue while trying to exec the mvnbuild script. Everyone should just use Linux/MacOS
          Hide
          kzantow Keith Zantow added a comment - - edited

          Well, thing #1 seems to be that Windows doesn't like executing a .js file, in gulp-runner/index.js line 34, changing that section to something like this fixed that issue. Not sure if it's better to submit a patch to the gulp-runner or just make our own.

            var process = require('process');
            var gulpBin = require.resolve('gulp/bin/gulp.js');
            var gulpOpts = [gulpBin].concat(buildOpts(tasks, options));
            var gulp = child.spawn(process.execPath, gulpOpts, {
              detached: true,
              cwd: __dirname
            })
          
          Show
          kzantow Keith Zantow added a comment - - edited Well, thing #1 seems to be that Windows doesn't like executing a .js file, in gulp-runner/index.js line 34, changing that section to something like this fixed that issue. Not sure if it's better to submit a patch to the gulp-runner or just make our own. var process = require( 'process' ); var gulpBin = require.resolve( 'gulp/bin/gulp.js' ); var gulpOpts = [gulpBin].concat(buildOpts(tasks, options)); var gulp = child.spawn(process.execPath, gulpOpts, { detached: true , cwd: __dirname })
          Hide
          kzantow Keith Zantow added a comment - - edited

          Ok, some more progress here.. I actually got this working, but it required hacking some more stuff in node_modules. In particular:

          I installed 14.1.0 of browserify, and modified index.js line 32 to be:

          var cpr = require('cached-path-relative');
          var relativePath = (...args) => cpr.apply(cpr, args).replace(/\\/g,'/')
          

          Although it doesn't seem to be required, I think we should also set exposeAll in the browserify config (bundlegen line ~181 exposeAll: true, ), as it has the result of putting relative paths instead of full paths in the bundle, which seems to make a lot more sense than seeing some randomness in there (right now, it's paths like: /home/ubuntu/slave/workspace/Blue Ocean docker image/blueocean/blueocean-dashboard/node_modules/asn1.js/lib/asn1/base/buffer.js).

          Doesn't seem to make a difference but require_stub_transform var node_modules_path = '/node_modules/'; maybe should be using path.sep.

          Issued https://github.com/jonjaques/gulp-runner/pull/1 to fix gulp-runner, though we could just write the spawn command ourselves...

          Show
          kzantow Keith Zantow added a comment - - edited Ok, some more progress here.. I actually got this working, but it required hacking some more stuff in node_modules. In particular: I installed 14.1.0 of browserify, and modified index.js line 32 to be: var cpr = require( 'cached-path-relative' ); var relativePath = (...args) => cpr.apply(cpr, args).replace(/\\/g, '/' ) Although it doesn't seem to be required, I think we should also set exposeAll in the browserify config (bundlegen line ~181 exposeAll: true, ), as it has the result of putting relative paths instead of full paths in the bundle, which seems to make a lot more sense than seeing some randomness in there (right now, it's paths like: /home/ubuntu/slave/workspace/Blue Ocean docker image/blueocean/blueocean-dashboard/node_modules/asn1.js/lib/asn1/base/buffer.js ). Doesn't seem to make a difference but require_stub_transform var node_modules_path = '/node_modules/'; maybe should be using path.sep . Issued https://github.com/jonjaques/gulp-runner/pull/1 to fix gulp-runner, though we could just write the spawn command ourselves...
          Hide
          kzantow Keith Zantow added a comment -

          Tom FENNELLY you know the js-builder stuff lots better than I... I couldn't find much that was hardcoding / instead of using path.sep, but I assume that's what part of the issue could be, maybe that would ring a bell to you, otherwise we're looking at possibly getting a PR through to browserify :-/ (although they are hardcoding / in places, so it might be warranted and accepted).

          Show
          kzantow Keith Zantow added a comment - Tom FENNELLY you know the js-builder stuff lots better than I... I couldn't find much that was hardcoding / instead of using path.sep , but I assume that's what part of the issue could be, maybe that would ring a bell to you, otherwise we're looking at possibly getting a PR through to browserify :-/ (although they are hardcoding / in places, so it might be warranted and accepted).
          Hide
          kzantow Keith Zantow added a comment -

          ... finally, the node dependencies must be exactly the same as upstream dependencies in some cases - e.g. react, if blueocean-core-js is included or things get bundled in bad ways, multiple times causing errors, this is hopefully rectified by JENKINS-39646.

          Show
          kzantow Keith Zantow added a comment - ... finally, the node dependencies must be exactly the same as upstream dependencies in some cases - e.g. react, if blueocean-core-js is included or things get bundled in bad ways, multiple times causing errors, this is hopefully rectified by JENKINS-39646 .

            People

            • Assignee:
              kzantow Keith Zantow
              Reporter:
              michaelneale Michael Neale
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: