Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

require.js project optimization: can't find the dir value

Here is my project folder structure:

project
|--Gruntfile.js
|--build
|--public
|--|--js
|-----|--lib
|-----|--module
|-----|--main.js

my build config is in the Gruntfile.js

    requirejs: {
        compileProject: {
            baseUrl: 'js', 
            appDir: 'public', 
            dir: 'build',
            modules: [
                { name: 'main'}
            ],
            paths: {
                main: 'main',
                jquery: 'lib/jquery-1.10.0.min.js'
            }
        }
    }

but when I run it, the terminal tell me wrong:

Running "requirejs:compileProject" (requirejs) task [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".

however I have already set the dir value, so what's wrong with my code?

like image 979
hh54188 Avatar asked May 14 '26 19:05

hh54188


1 Answers

Your requirejs options should be specified within options:

requirejs: {
    compileProject: {
        options : {
            baseUrl: 'js', 
            appDir: 'public', 
            dir: 'build',
            modules: [
                { name: 'main'}
            ],
            paths: {
                main: 'main',
                jquery: 'lib/jquery-1.10.0.min.js'
            }
        }
    }
}
like image 114
go-oleg Avatar answered May 19 '26 02:05

go-oleg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!