Skip to content

R.js build fails with external resources defined in the "paths" config property #207

@dchekanov

Description

@dchekanov

main.js:

require.config({
    paths: {
        bootstrapCss: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min'
    },
    map: {
        '*': {
            'css': '../../css'
        }
    }
});

require(['css!bootstrapCss'], function() {});

build.js:

({
    name: 'main',
    out: 'main-optimized.js',
    mainConfigFile: 'main.js'
})
P:\require-css\test\2>node ../../node_modules/requirejs/bin/r.js -o build.js

Tracing dependencies for: main
Error: ENOENT: no such file or directory, open 'P:\require-css\test\2\https:\maxcdn.bootstrapcdn.com\bootstrap\3.3.6\css\bootstrap.min.css'
In module tree:
    main
      ../../css

This happens because css-builder.js checks if the module name is an absolute URL but not if the final file URL is.

I'll make a PR to fix this shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions