assetgraph-builder: require packages not supported?

I have a package in my require config in this manner:

 packages: [
        {
            name: 'CryptoJS',
            location: 'path-to/bower_components/crypto-js',
            main: 'index'
        }
    ]

but asset graph builder still tries to load CryptoJS from basepath and shows warnings am sure this is a valid configuration since the unbuilt version gets configured correctly . Paths work correctly if not defined in an array an I am not having any issue with them

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 24 (13 by maintainers)

Commits related to this issue

Most upvoted comments

(I promise that things will stabilize once we have a non-prerelease out 😃

Actually I can tell why it doesn’t happen. It’s a very recently introduced regression. Fixed in https://github.com/assetgraph/assetgraph-builder/commit/62fda2c0af766906e6892f090248a07d1e5b0312

Thank you, your tool rocks! here is the result: https://github.com/agalazis/sample-requirejs-asset-graph-build/blob/master/build/index.html Any idea on how to compress css? I thought there is only a nocompress flag (used when I don’t want compression) xD

Ah, and then you should probably change data-main="app/js/app" to data-main="app" because the baseUrl is in effect when the main module is loaded.

Could you remove the requirejs.config call from src/app/js/app.js and instead create an inline script right before <script data-main="app/js/app" src="bower_components/requirejs/require.js" type="text/javascript"></script> with this content:

<script>
var require = {
    appDir: ".",
    baseUrl: "app/js",
    paths: {
        'jquery'    : '../../bower_components/jquery/dist/jquery.min',
        'bootstrap' : '../../bower_components/bootstrap/dist/js/bootstrap.min',
        'jsrasign'  : '../../bower_components/kjur-jsrsasign/jsrsasign-latest-all-min'
    },
    packages: [
        {
            name: 'CryptoJS',
            location: '../../bower_components/crypto-js',
            main: 'index'
        }
    ],
    shim: {
        bootstrap:{
            "deps": [ "jquery" ]
        },
        jsrasign: {
            'exports': "jsrasign",
            init: function() {
                return {
                    KJUR: KJUR
                };
            }
        },

    }
};
</script>
<script data-main="app/js/app" src="bower_components/requirejs/require.js" type="text/javascript"></script>

Fixed on master for v5.

Correct, this construct is not supported 😕. Sorry for the delay in getting back to you.

I’m planning on changing the way require.js is supported so that we just “shell out” to r.js instead of attempting to reimplement it, sort of how the bundleSystemJs transform was implemented. That means we’ll support features like these, including all require.js plugins.