gulp requirejs Error: ENOENT: no such file or directory, open '/js/require_config.js', 一直報找不到require

 

gulp prod 時一直報這個錯,搞了很久,發現是gulp requirejs 插件的問題json

package.json 裏   "requirejs": "^2.1.20"   , 用2.1.20沒有問題,2.2 就報錯,gulp

難道是配置寫法有問題?????async

gulp.task('require', function(taskReady) {
    var requirejsConfig = {
      baseUrl: './src',
      name: 'js/main',
      paths: {},
      optimize: 'uglify',//'uglify';
      mainConfigFile: './src/js/require_config.js',
      out: './dist/build/js/main.js',
      //Inlines the text for any text! dependencies, to avoid the separate
      //async XMLHttpRequest calls to load those dependencies.
      inlineText: true,
      //Allow "use strict"; be included in the RequireJS files.
      useStrict: true,
      //Finds require() dependencies inside a require() or define call. 
      findNestedDependencies: true
    };
    requirejs.optimize(requirejsConfig, function () {
      taskReady();
    }, function (err) {
      console.log(err);
      taskReady();
    });
});

 

待確認,爲何這麼多奇怪的問題,浪費時間,最後大都發現就是某個版本的問題,    。。。夠。。。ide

相關文章
相關標籤/搜索