Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elm-Brunch compiling issue: 'split' of undefined

My Elm code (https://github.com/puruzio/seat_saver) works fine in Elm Reactor, and compiles well with elm-make, but when I compile it through brunch, I get the following error. This doesn't give me much clue as to where to fix the error.

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]

My project is based on the example found here http://www.cultivatehq.com/posts/phoenix-elm-10/ to which I am attempting to add multiple modules in separate files.

brunch-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
 }
};
like image 535
Jason O. Avatar asked Nov 09 '22 18:11

Jason O.


1 Answers

You can add following in plugins - babel section in your brunch-config.js

compact: false

i.e.

plugins: {


babel: {
   // Do not use ES6 compiler in vendor code
   ignore: [/web\/static\/vendor/],
   compact: false
 },
 elmBrunch: {          //<<<<<<<< Here is the elmBrunch configuration
  ...
 }
} 
like image 80
Zee Avatar answered Nov 15 '22 11:11

Zee