Skip to content

Include the layer JSON object in build.txt #327

Closed

Description

@guybedford

I've just removed layering support from Require-IS for this kind of a workflow, and it feels a bit wrong leaving people on their own with the paths configuration post-processing.

If a JSON object was included in the build.txt, then instead of having parse the build output, one could just read or copy and paste the build.txt to extract out the JSON layer data. This can then be directly copied into the production paths config for optimal layer loading.

Activity

  1. jrburke commented on Nov 30, 2012

    @jrburke
    Member

    Is this about mapping loader plugin IDs to built resources? I would rather handle that in 2.1.3, with the optiimzer injecting the optimization. Or, if this about having access to the build config, isn't that just reading the build.js file directly? it is already in JS or JSON format (depending on the options).

  2. guybedford commented on Dec 1, 2012

    @guybedford
    Author

    This is about having an object map from layer moduleIds to arrays of the defined moduleIds within them.

    Something like:

      {
        'my/core-layer': ['jquery', 'core-scripts'],
        'my/page-layer': ['page-scripts', 'page-script-dependency-not-in-core', 'some!plugin']
      }

    This data object is only shown in text form in the build output, requiring parsing. It doesn't exist as the modules in the build config because we need to know the final inclusion lists for each module, including all sub dependencies and exclusions applied.

    The above can then be used to form a direct paths mapping:

      {
        paths: {
          'jquery': 'my/core-layer',
          'core-scripts': 'my/core-layer',
          'page-scripts': 'my/page-layer',
          'page-script-dependency-not-in-core': 'my/page-layer',
          'some!plugin': 'my/page-layer'
        }
      }

    This is why I was wondering if it would be possible to use the same paths configuration as above to allow the pluginMap support as in requirejs/requirejs#497, because it is nice being able to apply the same approach here.

  3. jrburke commented on Dec 3, 2012

    @jrburke
    Member

    OK, I added some notes to requirejs/requirejs#497 to allow injecting a config for non-plugin resources too, which should then address the need from this ticket. Going to close this ticket in favor of the other one, as it gets more to the heart of config injection vs dealing with the build.txt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions