我有一个 RequireJS 项目。
我的 app.build 需要:
({
appDir: './',
baseUrl: "js",
dir: "dist",
mainConfigFile: "js/main.js",
modules: [ { name: 'main' } ],
optimizeCss: 'standard',
removeCombined: true,
preserveLicenseComments: false,
optimize: "uglify",
uglify: {
max_line_length: 1000,
compress: {
cascade: true,
drop_console: true,
keep_fargs: true
},
defines: {
DEBUG: ['name', 'false']
},
no_mangle: true
},
closure: {
CompilerOptions: {},
CompilationLevel: 'SIMPLE_OPTIMIZATIONS',
loggingLevel: 'WARNING'
}
})
编译后我有三个 js 文件 - require.js、main.js、domReady.js 我尝试通过 Almond 获取单个文件,我添加了一些参数:
({
appDir: './',
baseUrl: "js",
modules: [
{
name: '../lib/almond/almond'
},
{
name: 'main'
}
],
include: ['main'],
insertRequire: ['main'],
wrap: true,
dir: "dist",
mainConfigFile: "js/main.js",
optimizeCss: 'standard',
removeCombined: true,
preserveLicenseComments: false,
optimize: "uglify",
uglify: {
...
},
closure: {
...
}
})
但最后我仍然有三个文件......提前谢谢!