I have downloaded a project that uses AMD
. Everything works fine, but I wanted to test out how to concatenate all the compiled files into one output all.js
file. I found something about --out
parameter and followed the steps from here: https://stackoverflow.com/a/14302902/1252575
It didn't work for me, I'm getting an error:
The command "tsc --module AMD --out all.js "C:\TypeScriptWithRequireAMD_0.8.1\app\classes\Test.ts" "C:\TypeScriptWithRequireAMD_0.8.1\modules\require.d.ts" "C:\TypeScriptWithRequireAMD_0.8.1\app\classes\Greeter.ts" "C:\TypeScriptWithRequireAMD_0.8.1\app\AppConfig.ts" "C:\TypeScriptWithRequireAMD_0.8.1\app\AppMain.ts"" exited with code 1.
Here's how my file structure looks like:
Btw. I have a second question. Does --out
parameter copy contents from lib
catalog? If not, how to include them, too?
[edit 1.]
Oh, I forgot... It's a part of my .csproj
file:
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptSourceMap>--module AMD</TypeScriptSourceMap>
</PropertyGroup>
<Target Name="BeforeBuild">
<Message Text="Compiling TypeScript files" />
<Message Text="Executing tsc$(TypeScriptSourceMap) @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
<Exec Command="tsc $(TypeScriptSourceMap) --out all.js @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
</Target>
[edit 2.]
Here's my AppConfig.js
:
require.config({
baseUrl: '../',
paths: {
'jquery': 'lib/jquery-1.7.2',
'underscore': 'lib/underscore',
'backbone': 'lib/backbone',
'console': 'lib/console',
'greeter': 'app/classes/Greeter',
'test': 'app/classes/Test'
},
shim: {
jquery: {
exports: '$'
},
underscore: {
exports: '_'
},
backbone: {
deps: [
"underscore",
"jquery"
],
exports: "Backbone"
},
console: {
exports: "console"
},
greeter: {
deps: [
"test"
]
},
test: {
deps: [
"greeter"
]
}
}
});
require([
'jquery',
'underscore',
'backbone',
'console',
'app/AppMain',
'app/classes/Greeter',
'app/classes/Test'
], function ($, _, Backbone, console, main, greeter, test) {
var appMain = new main.AppMain();
appMain.run();
});