下面是我的构建配置文件: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'
}]
}
我使用"grunt requirejs":"~0.4.2"作为我的构建npm和Gruntfile requirejs配置+r.js 2.1.16:
requirejs: {
std: {
options: grunt.file.read('config/build.js')
}
}
每当我试图执行grunt requirejs时,它都会在我的控制台上抛出以下错误:
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:appnode_modulesgrunt-requirejsnode_modulesrequirejsbinr.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
你能帮我一下吗?告诉我在配置中遗漏了什么?
谢谢&问候
您使用的是grunt.file.read
,它读取文件并将文件内容作为字符串返回。
请改用grunt.file.readJSON
。