madsflensted / elm-brunch

Brunch plugin to compile Elm code
MIT License
74 stars 31 forks source link

Confused about configuration #29

Closed simonh1000 closed 6 years ago

simonh1000 commented 7 years ago

Problem

Elm is compiling the file I just saved, rather than Main.elm where my main function resides. As a result I don't get the new functionality when I save (and have to switch the Main.elm and fake a save of that) and I'm getting files such as app.js.map in /priv/static/js

I've looked at the examples, but made no progress. Can you help?

Information

{ "version": "1.0.0", "summary": "helpful summary of your project, less than 80 characters", "repository": "https://github.com/user/project.git", "license": "BSD3", "source-directories": [ "web/elm", "." ], "exposed-modules": [], "dependencies": { "elm-lang/core": "5.0.0 <= v < 6.0.0", "elm-lang/html": "2.0.0 <= v < 3.0.0", "elm-lang/http": "1.0.0 <= v < 2.0.0" }, "elm-version": "0.18.0 <= v < 0.19.0" }

madsflensted commented 7 years ago

have you tried setting the elmFolder setting, and changing your mainModules path accordingly?

On Tue, Oct 18, 2016 at 11:43 PM, Simon Hampton notifications@github.com wrote:

Problem

Elm is compiling the file I just saved, rather than Main.elm where my main function resides. As a result I don't get the new functionality when I save (and have to switch the Main.elm and fake a save of that) and I'm getting files such as app.js.map in /priv/static/js

I've looked at the examples, but made no progress. Can you help? Information

  • ["^0.7.0", ] elm-brunch version
  • ["2.7.4" ] brunch version
  • [6.7 ] nodejs version
  • [see below ] content of brunch-config.js
  • [ see below] content of elm-package.json
  • [web/elm ] file layout for your elm files relative to root of

    project.

    [ Ubuntu 16.04] Operating System

    elmBrunch: { // Set to path where elm-make is located, relative to elmFolder (optional) // executablePath: '../../node_modules/elm/binwrappers',

    // Set to path where elm-package.json is located, defaults to project root (optional) // if your elm files are not in /app then make sure to configure paths.watched in main brunch config // elmFolder: '.',

    // Set to the elm file(s) containing your "main" function // elm make handles all elm dependencies (required) // relative to elmFolder mainModules: ['web/elm/Main.elm'],

    // Defaults to 'js/' folder in paths.public (optional) // outputFolder: 'some/path/',

    // If specified, all mainModules will be compiled to a single file (optional and merged with outputFolder) outputFile: 'main.js',

    // optional: add some parameters that are passed to elm-make makeParameters : ['--warn'] },

{ "version": "1.0.0", "summary": "helpful summary of your project, less than 80 characters", "repository": "https://github.com/user/project.git", "license": "BSD3", "source-directories": [ "web/elm", "." ], "exposed-modules": [], "dependencies": { "elm-lang/core": "5.0.0 <= v < 6.0.0", "elm-lang/html": "2.0.0 <= v < 3.0.0", "elm-lang/http": "1.0.0 <= v < 2.0.0" }, "elm-version": "0.18.0 <= v < 0.19.0" }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/madsflensted/elm-brunch/issues/29, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ8r4i1JfWJKo2IbqRYo1ead9xB75vZHks5q1Ok3gaJpZM4KZ9Ri .

simonh1000 commented 7 years ago

I tried:

elmBrunch: {
    elmFolder: 'web/elm',
    mainModules: ['Main.elm'],
    outputFile: 'main.js',
    makeParameters : ['--warn']
},

and now I get the following when I run mix phoenix.server

Elm compile: web/elm/App.elm, to priv/static/js/app.js
Elm compile: web/elm/Decoders.elm, to priv/static/js/decoders.js
Elm compile: web/elm/Main.elm, to priv/static/js/main.js

and that results in multiple .js files

madsflensted commented 7 years ago

Ok.

Hadn't spotted that your elm-package.json was i your project root. Then your original settings are the right ones.

What output do you get from the plugin when running in the 1st scenario?

On Wed, Oct 19, 2016 at 4:01 PM, Simon Hampton notifications@github.com wrote:

I tried:

elmBrunch: { elmFolder: 'web/elm', mainModules: ['Main.elm'], outputFile: 'main.js', makeParameters : ['--warn'] },

and now I get the following when I run mix phoenix.server

Elm compile: web/elm/App.elm, to priv/static/js/app.js Elm compile: web/elm/Decoders.elm, to priv/static/js/decoders.js Elm compile: web/elm/Main.elm, to priv/static/js/main.js

and that results in multiple .js files

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/madsflensted/elm-brunch/issues/29#issuecomment-254742129, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ8r4leZlkj-Qp9fcXyJQLyuFKwx7zTTks5q1c5pgaJpZM4KZ9Ri .

simonh1000 commented 7 years ago

I cut some files from the list before for simplicity. I deleted /priv/static/js and restarted phoenix. This is what I saw

Elm compile: web/elm/App.elm, to priv/static/js/app.js
Elm compile: web/elm/Decoders.elm, to priv/static/js/decoders.js
Elm compile: web/elm/DragDrop.elm, to priv/static/js/dragdrop.js
Elm compile: web/elm/DropZone.elm, to priv/static/js/dropzone.js
Elm compile: web/elm/FileReader.elm, to priv/static/js/filereader.js
Elm compile: web/elm/Main.elm, to priv/static/js/main.js
Elm compile: web/elm/MimeType.elm, to priv/static/js/mimetype.js
19 Oct 11:55:32 - info: compiled 14 files into 2 files, copied 3 in 1.9 sec

Could it have something to do with me using App.elm as a filename, while there is an app.js as part of the basic Phoenix setup

madsflensted commented 7 years ago

Looks like elm-brunch is not picking up the mainModules configuration item. Since it insists on compiling elm files to individual js targets

On Oct 19, 2016 17:58, "Simon Hampton" notifications@github.com wrote:

I cut some files from the list before for simplicity. I deleted /priv/static/js and restarted phoenix. This is what I saw

Elm compile: web/elm/App.elm, to priv/static/js/app.js Elm compile: web/elm/Decoders.elm, to priv/static/js/decoders.js Elm compile: web/elm/DragDrop.elm, to priv/static/js/dragdrop.js Elm compile: web/elm/DropZone.elm, to priv/static/js/dropzone.js Elm compile: web/elm/FileReader.elm, to priv/static/js/filereader.js Elm compile: web/elm/Main.elm, to priv/static/js/main.js Elm compile: web/elm/MimeType.elm, to priv/static/js/mimetype.js 19 Oct 11:55:32 - info: compiled 14 files into 2 files, copied 3 in 1.9 sec

Could it have something to do with me using App.elm as a filename, while there is an app.js as part of the basic Phoenix setup

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/madsflensted/elm-brunch/issues/29#issuecomment-254768334, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ8r4sdHcqmsJRhQpfJZ9iDVXEQ5KlYgks5q1enOgaJpZM4KZ9Ri .

simonh1000 commented 7 years ago

Is that something I can fix myself?

On 19 Oct 2016 16:38, "Mads Flensted-Urech" notifications@github.com wrote:

Looks like elm-brunch is not picking up the mainModules configuration item. Since it insists on compiling elm files to individual js targets

On Oct 19, 2016 17:58, "Simon Hampton" notifications@github.com wrote:

I cut some files from the list before for simplicity. I deleted /priv/static/js and restarted phoenix. This is what I saw

Elm compile: web/elm/App.elm, to priv/static/js/app.js Elm compile: web/elm/Decoders.elm, to priv/static/js/decoders.js Elm compile: web/elm/DragDrop.elm, to priv/static/js/dragdrop.js Elm compile: web/elm/DropZone.elm, to priv/static/js/dropzone.js Elm compile: web/elm/FileReader.elm, to priv/static/js/filereader.js Elm compile: web/elm/Main.elm, to priv/static/js/main.js Elm compile: web/elm/MimeType.elm, to priv/static/js/mimetype.js 19 Oct 11:55:32 - info: compiled 14 files into 2 files, copied 3 in 1.9 sec

Could it have something to do with me using App.elm as a filename, while there is an app.js as part of the basic Phoenix setup

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/madsflensted/elm-brunch/issues/29#issuecomment- 254768334, or mute the thread https://github.com/notifications/unsubscribe-auth/ AJ8r4sdHcqmsJRhQpfJZ9iDVXEQ5KlYgks5q1enOgaJpZM4KZ9Ri .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/madsflensted/elm-brunch/issues/29#issuecomment-254832713, or mute the thread https://github.com/notifications/unsubscribe-auth/AFA2FKFaCNxaxDJ0HvdovfTTipx6A4pOks5q1itWgaJpZM4KZ9Ri .

madsflensted commented 7 years ago

Not sure why. You can try to add some debug to elm-brunch/index.js in your node_modules folder and see if you can find out why.

The general idea is that any file being watched will cause all main modules to be compiled instead of the file itself.

On Oct 19, 2016 22:49, "Simon Hampton" notifications@github.com wrote:

Is that something I can fix myself?

On 19 Oct 2016 16:38, "Mads Flensted-Urech" notifications@github.com wrote:

Looks like elm-brunch is not picking up the mainModules configuration item. Since it insists on compiling elm files to individual js targets

On Oct 19, 2016 17:58, "Simon Hampton" notifications@github.com wrote:

I cut some files from the list before for simplicity. I deleted /priv/static/js and restarted phoenix. This is what I saw

Elm compile: web/elm/App.elm, to priv/static/js/app.js Elm compile: web/elm/Decoders.elm, to priv/static/js/decoders.js Elm compile: web/elm/DragDrop.elm, to priv/static/js/dragdrop.js Elm compile: web/elm/DropZone.elm, to priv/static/js/dropzone.js Elm compile: web/elm/FileReader.elm, to priv/static/js/filereader.js Elm compile: web/elm/Main.elm, to priv/static/js/main.js Elm compile: web/elm/MimeType.elm, to priv/static/js/mimetype.js 19 Oct 11:55:32 - info: compiled 14 files into 2 files, copied 3 in 1.9 sec

Could it have something to do with me using App.elm as a filename, while there is an app.js as part of the basic Phoenix setup

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/madsflensted/elm-brunch/issues/29#issuecomment- 254768334, or mute the thread https://github.com/notifications/unsubscribe-auth/ AJ8r4sdHcqmsJRhQpfJZ9iDVXEQ5KlYgks5q1enOgaJpZM4KZ9Ri .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/madsflensted/elm-brunch/issues/29#issuecomment- 254832713, or mute the thread https://github.com/notifications/unsubscribe-auth/ AFA2FKFaCNxaxDJ0HvdovfTTipx6A4pOks5q1itWgaJpZM4KZ9Ri .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/madsflensted/elm-brunch/issues/29#issuecomment-254836094, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ8r4ltJahui5VNN9ToD3DAkcnf2jZWDks5q1i3YgaJpZM4KZ9Ri .

madsflensted commented 6 years ago

Closed due to inactivtiy