I'm just starting with typescript and I'm trying to set up a multi-page amd app.
Keeping inline with the setup provided by the requirejs team I have a common.ts file that has all my requirejs configs, ex:
// common.ts
require.config({
paths: {
'backbone': 'lib/backbone'
, 'jquery': 'lib/jquery'
, 'underscore': 'lib/underscore'
}
});
I then load requirejs with the following script tag:
<script data-main="http://blah/page1.js" src="http://blah/require.js"></script>
As instructed in the requirejs recommendations for a multipage app, I then load common.ts from within blah/page1.js and that's where I start having trouble.
What's the right way to import the commont.ts file?
I have not had any luck with import requireConfig = require('common');
since I'm not exporting anything from common.ts.
However, when I try to export anything, even a dummy value from common.ts it ends up wrapping the require.config()
call in a module definition function which breaks stuff with requirejs.
I took a longshot by trying to load it using /// <reference path="common.ts"/>
but of course that failed
I've also tried removing the import
declaration and just calling require('common')
but that fails to compile with Could not find symbol 'require'
Is there some way that I could load common.ts even though it does not export anything?