Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Missing either an "out" or "dir" config value. #780

Open
hegdeashwin opened this issue Feb 13, 2015 · 2 comments
Open

Error: Missing either an "out" or "dir" config value. #780

hegdeashwin opened this issue Feb 13, 2015 · 2 comments

Comments

@hegdeashwin
Copy link

Below is my build configuration file: build.js

({
    appDir: '../src',
    baseUrl: 'libs',
    paths: {
        app: 'js'
    },
    dir: '../prod',
    out:"../js/main-built.js",
    fileExclusionRegExp: /.less$/,
    optimize: "uglify2",
    optimizeCss: "standard",
    modules: [{
        name: '../js/main'
    }]
})

I am using "grunt-requirejs": "~0.4.2" as my build npm and Gruntfile requirejs configuration + r.js 2.1.16:

requirejs: {
    std: {
        options: grunt.file.read('config/build.js')
    }
}

Whenever i am try to execute grunt requirejs it is throwing below error on my console:

Error: Error: Missing either an "out" or "dir" config value. If using "appDir" for a full project optimization, use "dir". If you want to optimize to one file, use "out".
    at Function.build.createConfig (d:\app\node_modules\grunt-requirejs\node_modules\requirejs\bin\r.js:27717:19)

I want to consolidate some of the JS files like jquery and its plugins etc. into 1 file and i am using AMD pattern similar to project https://github.com/hegdeashwin/Protocore

Can you please help me out here and tell what i have missed in my configuration ?

Thanks & Regards

@chrisalcantara
Copy link

Bump

@jrburke
Copy link
Member

jrburke commented Mar 12, 2016

The error could be worded a bit better. The issue is that the config contains the settings for both a single file JS optimization and a whole project optimization.

If you only want to target bundling some modules into one JS file, that is a single file JS optimization. In that case, remove the dir, appDir settings and modules section, and just place the name at the top level of the config:

({
    baseUrl: 'libs',
    paths: {
        app: 'js'
    },
    out:"../js/main-built.js",
    fileExclusionRegExp: /.less$/,
    optimize: "uglify2",
    optimizeCss: "standard",
    name: '../js/main'
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants