I have done the following setup:
Added the following script tag:
<script src="Scripts/linq.js"></script>
Configure linq.js in the main.js
requirejs.config({ paths: { 'text': '../Scripts/text', 'durandal': '../Scripts/durandal', 'plugins': '../Scripts/durandal/plugins', 'transitions': '../Scripts/durandal/transitions', 'knockout': '../Scripts/knockout-2.3.0', 'jquery': '../Scripts/jquery-1.9.1,', 'linq': '../Scripts/linq' } // The ko in this project is already AMD , shim: { linq : { exports: 'Enumerable' } } });
Attempt to get a copy of it in one of my viewmodel (shell.js) like this:
define(['plugins/router', 'durandal/app','linq'], function (router, app, linq)
Optimizing the build using weyland, however I'm getting:
Error 1 ENOENT, no such file or directory 'C:\Project\build\App\linq.js' C:\Project\
I'm new to this, did I get anything wrong?
I thought the shim should point to the global variable, which I did.
Do I need to create my own define in addition to the shim? I thought Shim is supposed to be a syntactic sugar wrapper over define over a global variable?
A shim shouldn't be required in this situation, where
linq
is include via script tag. Just make sure loadlinq
via script tag before loadingmain.js
via require.js. Next remove the configuration entries and the dependency.That way there's no need to configure weyland to exclude it.