【问题标题】:Elm-Brunch compiling issue: 'split' of undefinedElm-Brunch 编译问题:未定义的“拆分”
【发布时间】:2016-06-19 09:43:04
【问题描述】:

我的 Elm 代码 (https://github.com/puruzio/seat_saver) 在 Elm Reactor 中运行良好,并且与 elm-make 一起编译良好,但是当我通过 brunch 编译它时,出现以下错误。这并没有给我太多关于在哪里修复错误的线索。

My-MacBook-Pro:seat_saver_old puruzio$ brunch build
Elm compile: Main.elm, in web/elm, to ../static/vendor/main.js
[BABEL] Note: The code generator has deoptimised the styling of "web/elm/app.js" as it exceeds the max of "100KB".
[BABEL] Note: The code generator has deoptimised the styling of "web/elm/elm.js" as it exceeds the max of "100KB".
05 Mar 16:16:51 - info: compiling
05 Mar 16:16:54 - error: [TypeError: Cannot read property 'split' of undefined]

我的项目基于http://www.cultivatehq.com/posts/phoenix-elm-10/ 此处的示例,我试图在单独的文件中添加多个模块。

早午餐配置.js

exports.config = {
  // See http://brunch.io/#documentation for docs.
  files: {
    javascripts: {
      joinTo: "js/app.js"
    },
    stylesheets: {
      joinTo: "css/app.css"
    },
    templates: {
      joinTo: "js/app.js"
    }
  },

  conventions: {
    assets: /^(web\/static\/assets)/
  },

  // Phoenix paths configuration
  paths: {
    // Dependencies and current project directories to watch
    watched: [
      "deps/phoenix/web/static",
      "deps/phoenix_html/web/static",
      "web/static",
      "test/static",
      "web/elm"
    ],

    // Where to compile files to
    public: "priv/static"
  },

// Configure your plugins
plugins: {
 babel: {
   // Do not use ES6 compiler in vendor code
   ignore: [/web\/static\/vendor/]
 },
 elmBrunch: {          //<<<<<<<< Here is the elmBrunch configuration
   elmFolder: 'web/elm',
   mainModules: ['Main.elm'],
   outputFolder: '../static/vendor'
 }
} ,

modules: {
  autoRequire: {
    "js/app.js": ["web/static/js/app"]
  }
},

 npm: {
   enabled: true
 }
};

【问题讨论】:

    标签: javascript plugins elm brunch


    【解决方案1】:

    您可以在 brunch-config.js 中的插件 - babel 部分添加以下内容

    compact: false
    

    plugins: {
    
    
    babel: {
       // Do not use ES6 compiler in vendor code
       ignore: [/web\/static\/vendor/],
       compact: false
     },
     elmBrunch: {          //<<<<<<<< Here is the elmBrunch configuration
      ...
     }
    } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-16
      • 2016-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-10
      相关资源
      最近更新 更多