I have been looking for a while but i haven't found a solution to my problem. I am using require.js and using a plugin to load data dynamically for some of the modules
define(['Plugin!data', 'dependency'], function(data, dep) {
...
}
The problem arises when I try to optimize all modules into a single build using r.js
requirejs.optimize({
baseURL: '/js',
name: 'main',
...
})
The optimizer tries to load the data through the plugin. Is there a way to avoid that ?
ie: how to tell the optimizer to not go through anything in the format Plugin!...
You can use
exclude
in your build configuration to exclude such modules. For instance:The problem with this though is that there is no pattern matching in
exclude
and you'll end up having to list each module individually, which can be a bit problematic on large code bases.Another method is to use the
onBuildWrite
to remove all modules starting withtext!
: