2016-03-05 18 views
5

Mã Elm của tôi (https://github.com/puruzio/seat_saver) hoạt động tốt trong Elm Reactor, và biên dịch tốt với elm-make, nhưng khi tôi biên dịch nó qua brunch, tôi nhận được lỗi sau. Điều này không cho tôi nhiều đầu mối về việc sửa lỗi.Vấn đề biên dịch Elm-Brunch: 'split' của undefined

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] 

Dự án của tôi dựa trên ví dụ được tìm thấy ở đây http://www.cultivatehq.com/posts/phoenix-elm-10/ mà tôi đang cố thêm nhiều mô-đun vào các tệp riêng biệt.

bưa ăn-config.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 
} 
}; 

Trả lời

1

Bạn có thể thêm sau trong plugin - phần babel trong bưa ăn-config.js bạn

compact: false 

ví dụ:

plugins: { 


babel: { 
    // Do not use ES6 compiler in vendor code 
    ignore: [/web\/static\/vendor/], 
    compact: false 
}, 
elmBrunch: {   //<<<<<<<< Here is the elmBrunch configuration 
    ... 
} 
} 
Các vấn đề liên quan