I have a web application that uses Require to load dependencies. I have a set of JS libraries that are included using the Require object config.shim.
Two such example libraries:
require.config({
shim: {
"libs/leaflet": {
exports: "L"
}
"libs/leaflet-dvf": {
deps: ["libs/leaflet"],
exports: "L"
}
}
The second library leaflet-dvfrequires the first leaflet. The second is a plugin to the first, which depends on the global sphere variable Lthat the first library defines.
When I launch the application using "Require Normal", everything works fine. I can turn on either the library from the strip, and everything works fine. No problems.
, Require r.js Optimizer. , JS , . leaflet-dvf leaflet. JS runtime, L.
:
({
baseUrl: "../js",
paths: {
"requireLib": "../js/libs/require"
},
include: ["requireLib"],
name: "Main",
out: "bin/Main-built.js",
optimize: "none",
wrapShim: true
})
, Rhino, . Main-built.js . L undefined error.
Shims, JS ?