requirejs-optimizer

Embedded ember-cli project conflicts with RequireJS

浪子不回头ぞ 提交于 2020-02-20 09:22:10
问题 I'm trying to embed an EmberJS application into a large portal application which uses extensively the RequireJS library. I'm using ember-cli to build the project. The built application consists of two files, dist/assets/vendor.js and dist/assets/myapp.js . The EmberJS application works after embedding it but the portal app's javascript breaks. After some research I've found out the problem is that vendor.js defines its own variables require , requirejs , requireModule and define which

Require.js (almond.js) Timing Off

本小妞迷上赌 提交于 2020-01-14 05:24:06
问题 I'm trying to use Almond.js and the Require.js optimizer to make a standalone file that can be used without Require.js. I've been able to successfully compile the file, and all the code runs, but there's one problem: the code executes in the wrong order. Let's say my main file (the one that's in the include= option passed to the optimizer) has the following: console.log('outside'); require(['someFile'], function(someModule) { console.log('inside'); window.foo = someModule.rightValue; }); and

RequireJS optimization into multiple modules

♀尐吖头ヾ 提交于 2019-12-07 22:58:32
问题 I am trying to use RequireJS to modularize our JS into a few larger JS files so that dependencies can be loaded on-demand but without the heft of a large single-JS download when loading the page. As an example, with the JS files as: js/main.js js/views/category1/js1.js js/views/category1/js2.js js/views/category2/js1.js js/views/category2/js2.js Some parts of the application (e.g. everything in category1) are only used by certain types of users, and similarly with category2, so it doesn't

Play 2.3 requireJs optimization and shim for multiple modules

北慕城南 提交于 2019-12-07 07:22:26
问题 This is my current setup for Play 2.2.x requireJS. Will it continue to work after 2.3? I can't find requireJs or requireJsShim anywhere in the 2.3 documentation. requireJs ++= Seq("mainAccount.js", "mainOrg.js", "mainPublic.js"), // This tells Play to optimize this file and its dependencies requireJsShim += "build.js", // This tells Play to read the RequireJS "shim" configuration from build.js requireJsFolder := "js" 回答1: Instead of requireJs use: RjsKeys.modules := Seq( WebJs.JS.Object("name

Play 2.3 requireJs optimization and shim for multiple modules

依然范特西╮ 提交于 2019-12-05 12:40:59
This is my current setup for Play 2.2.x requireJS. Will it continue to work after 2.3? I can't find requireJs or requireJsShim anywhere in the 2.3 documentation. requireJs ++= Seq("mainAccount.js", "mainOrg.js", "mainPublic.js"), // This tells Play to optimize this file and its dependencies requireJsShim += "build.js", // This tells Play to read the RequireJS "shim" configuration from build.js requireJsFolder := "js" Instead of requireJs use: RjsKeys.modules := Seq( WebJs.JS.Object("name" -> "mainAccount"), WebJs.JS.Object("name" -> "mainOrg"), WebJs.JS.Object("name" -> "mainPublic") ) Instead

How to use RequireJS optimizer in Play framework?

早过忘川 提交于 2019-12-04 23:49:18
问题 As advertised, the rjs in Play can ensure that any JavaScript resources referenced from within a WebJar are automatically referenced from the jsdelivr CDN. In addition if any .min.js file is found then that will be used in place of .js. An added bonus here is that there is no change required to your html! However, I cannot seem to get any of that to work. I tried running my Play app in production mode, and all my webjar javascripts are still being referenced as local. I do not see the .min

How to use RequireJS optimizer in Play framework?

依然范特西╮ 提交于 2019-12-03 15:36:33
As advertised, the rjs in Play can ensure that any JavaScript resources referenced from within a WebJar are automatically referenced from the jsdelivr CDN. In addition if any .min.js file is found then that will be used in place of .js. An added bonus here is that there is no change required to your html! However, I cannot seem to get any of that to work. I tried running my Play app in production mode, and all my webjar javascripts are still being referenced as local. I do not see the .min version of javascript files being used in production. I cannot get dependency injection to work in

Replace module ids with fake names

北战南征 提交于 2019-12-02 14:36:11
问题 Imagine an AMD Java-Script Application consisting of three modules with those IDs: common/core/api common/data/foo common/remote/bar When I'm building the optimized file with r.js, those ids are still inside compiled file. IMO this is unnecessary. For example, the optimized file would still work when I search-and-replace the following: common/core/api -> a common/data/foo -> b common/remote/bar -> c The advantages of the substitutions are: smaller filesize better obscurity (Yes, you should

Replace module ids with fake names

白昼怎懂夜的黑 提交于 2019-12-02 11:22:52
Imagine an AMD Java-Script Application consisting of three modules with those IDs: common/core/api common/data/foo common/remote/bar When I'm building the optimized file with r.js, those ids are still inside compiled file. IMO this is unnecessary. For example, the optimized file would still work when I search-and-replace the following: common/core/api -> a common/data/foo -> b common/remote/bar -> c The advantages of the substitutions are: smaller filesize better obscurity (Yes, you should never trust the client. Still, substituting the module names would require a reverse engeneer to guess a