Skip to content

Relative path ./ in modules not generating as expected? #961

Open

Description

@JohnRSim

I have 2 files that make up my module CoreFile.js that loads in myFile.js as below

CoreFile.js

define(['./myFile'],function(){});

myFile.js

define([],function(){});

When I optimise the module with r.js lets call the output module.js it is converted like this and brings the 2 files into 1.. perfect -

optimised to module.js
module.js

define('blah/myFile',[],function(){});
define('blah/CoreFile',['./myFile'],function(){});

However shouldn't the CoreFile.js generate and update the myFile path to the module name like this -- 'blah/myFile' instead of './myFile'?

This is how I am expecting the module to generate -

define('blah/myFile',[],function(){});
define('blah/CoreFile',['blah/myFile'],function(){});

and use the module name as I've noticed that.
When I load in the optimised module.js
a call to load ./myFile' is still made instead of using the named module that is available in the module.js ie 'blah/myFile'

if I manually update the optimised module.js from './myFile' to 'blah/myFile' ie -

define('blah/myFile',[],function(){});
define('blah/CoreFile',['blah/myFile'],function(){});

then it works as intended... and there isn't a call to load in the file that has been pulled into the module..

Thanks

Activity

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