Comments (11)
Just read the comment //Ignores files/directories that start with a period (.).
for file.getFilteredFileList
. Obviously this is intentional so ignore this issue.
from r.js.
Correct, but you can override this regexp by setting dirExclusionRegExp in the build file's configuration.
from r.js.
Thanks for the quick reply! =) Looking at that variable, it only comes into play for directories, not files. In the if (stat.isFile())
branch, the bottom if is (line 2453) if (ok && !fileName.match(/^\./))
Files with a beginning period are always skipped?
from r.js.
Changing that line to if (ok && !fileName.match(file.dirExclusionRegExp))
instead fixes the issue for me.
If dirExclusionRegExp = /^\./
then .htaccess is not copied.
If dirExclusionRegExp = null
then .htaccess is copied.
dirExclusionRegExp is set via my app.build.js.
from r.js.
Thanks for pointing out the weakness in the code. I pushed a change, and you can try r-edge.js to confirm the fix. I changed the official name of the build config to fileExclusionRegExp, but dirExclusionRegExp is still supported for backwards compatibility.
from r.js.
Actually it would be handy to have both, one for Dirs and one for Files. As it is currently, dirExclusionRegExp only works when it is NOT a file so changing the property name lessens the semantic meaning.
from r.js.
I had thought of having two different ones, but I think it was just easier to adjust the regexp to only match what did not need to be copied for both.
A common scenario would be having a .git directory that you want to ignore, but have .htaccess files you want copied, so fileExclusionRegExp = /^.git$/ would be good enough. It is also a very subtle, advanced setting and I wanted to avoid putting in two many knobs that can be twiddled.
Maybe if I expand the comment in the example.build.js to give an example of how to not copy over a .git file but do copy a .htaccess file, that would help, or did I misunderstand your point?
from r.js.
Nope, that makes perfect sense! =) Thanks!
from r.js.
This kind of doesn't work, I'd be happy to be wrong,
but I have all my scripts in paths like: js/models/model.js,
for instance, when I run this, the app doesn't find any path in any sub directory
beyond main main scripts path: js. Shouldn't my main.js resolve all the folders
correctly if my application works?
Why doesn't R just load my main.js and figure out all the sub directories correctly?
When I run:
node ../../r.js -o name=main out=main-built.js baseUrl=.
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Error: Error evaluating module "undefined" at location "/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/activate/js/jquery.js":
Error: ENOENT, no such file or directory
^^^ /Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/activate/js/jquery.js is not file it's
folder.
'/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/activate/js/jquery.js'
fileName:/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/activate/js/jquery.js
lineNumber: undefined
http://requirejs.org/docs/errors.html#defineerror
In module tree:
main
app
at Function.onError (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:7911:23)
at execManager (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:615:28)
at /Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:643:25
at execManager (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:620:17)
at /Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:643:25
at execManager (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:620:17)
at /Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:643:25
at execManager (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:620:17)
at /Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:643:25
at execManager (/Users/plemiuex/Documents/fb_workspace_samsung/activation_backbone/r.js:620:17)
// main.js
require.config({
paths: {
'jquery': 'libs/jquery/jquery-1.6.4.min',
'underscore': 'libs/underscore/underscore-min',
'restDelegate': 'delegates/restDelegate',
'backbone': 'libs/backbone/backbone-amd', // AMD support
'omniture': 'libs/omniture/s_code',
'models': 'models',
'views': 'presentation/views',
'utils': 'utils',
'templates': 'presentation/templates/desktop'
},
priority: [
'underscore',
'backbone',
'jquery',
'tests/testsuite',
'app-tests']
});
require([
'domReady', // optional, using RequireJS domReady plugin
'app-tests'
], function(domReady, app){
domReady(function () {
app.initialize();
});
});
from r.js.
@reduxdj: r.js does just trace the dependencies in main.js. However, by default the r.js config does not read the config values in a main.js, since they are often different (in particular things like CDN-loaded resources will not work). So, for the dependencies that have paths config are likely not being seen.
For 1.0.5 (which I want out this week), I want to make this easier by allowing you to just pass the path to your JS file that has the main config block, that work is being tracked in #81. In the meantime though, you will need to pass the config values to the r.js command. you may want to just use a build config file to store them.
from r.js.
That would be a great enhancement. Thanks for the response
from r.js.
Related Issues (20)
- How to use requirejs optimizer to create Module specific code chunk instead of big single file for Backbone project? HOT 3
- Wrong relative path for module-create in source map HOT 1
- Java/JSS 10 build error HOT 3
- Cannot use functions for out and onModuleBundleComplete simultaneously
- Any plans for supporting ES2017+ in uglify/minify? HOT 1
- ES6 Object Spread syntax not work HOT 4
- [QUESTION] Where I can find the CI service? HOT 1
- TypeError: Cannot read property 'type' of undefined HOT 4
- r js stops loading dependecies of module when i use specific module name for that file. HOT 1
- Unexpected token ... HOT 12
- preserveLicenseComments should do its best to not add multiple identical licenses from the same project. HOT 2
- This is not an issue and should be removed
- Define Incorrectly Updated When No Dependencies And Function Wrapped In Parentheses
- Bundaling ES class with static field lead to [Error: Line 5: Unexpected token =] HOT 1
- Unable to concatenate all module to single file HOT 1
- Has insecure URLs (ESLint error: no-insecure-url)
- Add a security policy HOT 4
- Can I transpile a commonjs AST from rollup watch with some code from here?
- e.getLayout is not a function after upgrading to requirejs 2.3.6
- Prototype Pollution Vulnerability Affecting [email protected] module HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from r.js.