Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.bundles can't use config.map values #1429

Closed
ORESoftware opened this issue Sep 30, 2015 · 1 comment
Closed

config.bundles can't use config.map values #1429

ORESoftware opened this issue Sep 30, 2015 · 1 comment

Comments

@ORESoftware
Copy link

As far as I can tell, map values are not being referenced in bundles values in requirejs.config({})

if I have this:

 map: {
        '*': {
            'REACT_VIEWS_BASE': 'app/js/jsx/reactComponents',
            'STANDARD_VIEWS_BASE': 'app/js/jsx/allStandardViews',
            'TEMPLATES_BASE':'text!app/templates'
        }
    },

and I have this:

   bundles: {
        'app/optimized/bundles/DashboardView': [
            'STANDARD_VIEWS_BASE/DashboardView',
            'REACT_VIEWS_BASE/ServiceChooser',
            'REACT_VIEWS_BASE/Service',
            'TEMPLATES_BASE/dashboardTemplate.ejs'
        ],
        'app/optimized/bundles/JobsView': [
            'app/js/jsx/relViews/jobs/jobsView',
            'REACT_VIEWS_BASE/JobsList',
            'REACT_VIEWS_BASE/Job',
            'TEMPLATES_BASE/jobsTemplate.ejs'
        ],
        'app/optimized/bundles/OverView': [
            'STANDARD_VIEWS_BASE/OverviewView',
            'REACT_VIEWS_BASE/RealTimeSearchView',
            'TEMPLATES_BASE/overviewTemplate.ejs'
        ],
        'app/optimized/bundles/UserProfile': [
            'STANDARD_VIEWS_BASE/UserProfileView',
            'TEMPLATES_BASE/userProfileTemplate.ejs'
        ]
    },

it doesn't work as expected, and it seems clear that the values from map are not being used to evaluate the strings in bundles (I guess, why should they?). Shouldn't map take precedence over bundles and subsequently referenced in bundles?

It could be that map is only referenced in require and define, but why not bundles too? I can confirm that map values are successfully referenced in the include option in build config files, such as so:

  HomeAndIndexView: _.extendOwn({}, baseConfig, {
            "out": "./public/static/app/optimized/bundles/HomeAndIndexView.js",
            "include": [
                'STANDARD_VIEWS_BASE/HomeView',
                'REACT_VIEWS_BASE/TimerExample',
                'STANDARD_VIEWS_BASE/PortalView',
                'REACT_VIEWS_BASE/MenuExample',
                'STANDARD_VIEWS_BASE/HeaderView',
                'STANDARD_VIEWS_BASE/FooterView',
                'STANDARD_VIEWS_BASE/RegisteredUsersView',
                'STANDARD_VIEWS_BASE/LoginView',
                'STANDARD_VIEWS_BASE/IndexView'

            ]
        }),
@ORESoftware ORESoftware changed the title config.bundles can't use config.maps values config.bundles can't use config.map values Sep 30, 2015
@jrburke
Copy link
Member

jrburke commented Nov 17, 2015

It gets confusing if some properties at the top level should or should not use map: if some do and some do not it will be hard to trace how things bottom out to final IDs. The goal with configuration should be to work on final, resolved, absolute module IDs.

@jrburke jrburke closed this as completed Nov 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants