0

I would like to set a requirejs configuration variable which would be available via module.config. The optimizer does not seem to pass this through. Is this possible, or should I handle this step via my build process.

2 Answers 2

1

You have to set it in your config file for a specific module like this and as long as your told r.js to use this config file it should work:

requirejs.config({

  config: {
    'path/to/myModule': {
      someSetting: 'someSetting'
    }
  }
});
Sign up to request clarification or add additional context in comments.

Comments

0

A simple solution seems to be to be:

  1. Create a config file for each environment (eg., config, config-production)
  2. When you want your config, require('/path/to/config')
  3. When you call r.js, just put in a paths argument (eg., r.js -o build.js paths.config=config-production)
  4. You now have your production configuration settings

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.