本文介绍了早午餐如何禁用RequireJS模块包装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:
  对于任何有兴趣使用与我已经把在一起种子工程

我使用与。 提供了一个模块系统,所以需要使用CommonJS的导入文件/ AMD是多余的。是否有可能取消在 /应用程序目录此功能的文件?基本上我想它像它的 /供应商目录编制不变的文件。

I'm using Brunch with AngularJS. AngularJS provides a module system so the need for importing file using commonJS / AMD is redundant. Is it possible to disable this feature for files in the /app directory? Essentially I would like it to compile files unaltered like it does for the /vendor directory.

所以pferred了$ P $来将是:

So the preferred out come would be:

  joinTo:
    'js/app.js': /^app/
    'js/vendor.js': /^vendor/

使用两个 JS / app.js JS / vender.js 包含每个相应文件夹中的文件进行编译,但也包裹着。

With both js/app.js and js/vender.js containing compile files from each respective folder, but neither wrapped.

有没有人有什么想法?

更新
语法已经从当@jcruz答案改变。在这里,现在要做到这一点的方式。

UPDATEThe syntax has changed from when @jcruz answer. Here's the way to do this now.

在我与@jcruz答案的修改版本去结束

In the end I went with a modified version of @jcruz answer.

exports.config =
  modules:
    definition: false
    wrapper: (path, data) ->
      """
(function() {
  'use strict';
  #{data}
}).call(this);\n\n
      """
  files:
    javascripts:
      defaultExtension: 'coffee'
      joinTo:
        'js/app.js': /^app/
        'js/vendor.js': /^vendor/

默认情况下,原始包装不包括的CoffeeScript的标准包装。通过jsWrapper设置为:

By default the "raw" wrapper does not include coffeescript's standard wrapper. By setting jsWrapper to:

wrapper: (path, data) ->
  """
(function() {
  'use strict';
  #{data}
}).call(this);
  """

如预期文件将被包裹。

files will be wrapped as expected.

推荐答案

我不相信释放瓦特/这些功能是在NPM还,但你可以只是重新安装从GitHub库早午餐

I dont believe the release w/ these features is on npm yet but you could just re-install brunch from the github repo

一旦你这样做早午餐,在你config.coffee设置jsWrapper为原始

Once you do that Brunch, set jsWrapper to 'raw' in your config.coffee

这样的事情...

exports.config =
  jsWrapper: 'raw'
  files:
    javascripts:
      defaultExtension: 'js'
      joinTo:
        'javascripts/app.js': /^app/
        'javascripts/vendor.js': /^vendor/

早午餐b'和包装code应该消失

'brunch b' and the wrapping code should disappear

这篇关于早午餐如何禁用RequireJS模块包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 17:38