Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

brunch plugin build order #35

Closed
7 tasks
bigardone opened this issue Mar 21, 2017 · 12 comments
Closed
7 tasks

brunch plugin build order #35

bigardone opened this issue Mar 21, 2017 · 12 comments

Comments

@bigardone
Copy link

bigardone commented Mar 21, 2017

Problem

Hi! I'm experimenting an issue in a project, where I'm using elm-brunch along with babel-brunch. The issue is that elm-babel seems to be building first, and one of the js files is importing the main.js created by elm-brunch, which doesn't exist yet, so the build breaks due to not finding that file. I've tried arranging the npm modules to solve the build order issue, as specified in here brunch/brunch#1377 (comment), but it doesn't solve the problem. What can I do?

Information

  • elm-brunch version
    elm-brunch@0.8.0

  • brunch version
    brunch@2.10.9

  • nodejs version
    v7.7.3

  • content of brunch-config.js
    exports.config = {
    // See http://brunch.io/#documentation for docs.
    files: {
    javascripts: {
    joinTo: {
    'js/app.min.js': /^(web/static/js|renderer)/,
    'js/vendor.min.js': /^(node_modules|elm)/,
    },

    // To use a separate vendor.js bundle, specify two files path
    // http://brunch.io/docs/config#-files-
    // joinTo: {
    //  "js/app.js": /^(web\/static\/js)/,
    //  "js/vendor.js": /^(web\/static\/vendor)|(deps)/
    // }
    //
    // To change the order of concatenation of files, explicitly mention here
    // order: {
    //   before: [
    //     "web/static/vendor/js/jquery-2.1.1.js",
    //     "web/static/vendor/js/bootstrap.min.js"
    //   ]
    // }
    

    },
    stylesheets: {
    joinTo: 'css/app.css',
    order: {
    after: ['web/static/css/app.scss'], // concat app.css last
    },
    },
    templates: {
    joinTo: 'js/app.js',
    },
    },

    conventions: {
    // This option sets where we should place non-css and non-js assets in.
    // By default, we set this to "/web/static/assets". Files in this directory
    // will be copied to paths.public, which is "priv/static" by default.
    assets: /^(web/static/assets)/,
    },

    // Phoenix paths configuration
    paths: {
    // Dependencies and current project directories to watch
    watched: [
    'elm',
    'renderer/client',
    'renderer/common',
    'web/static',
    'test/static',
    ],

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

    // Configure your plugins
    plugins: {
    elmBrunch: {
    elmFolder: 'elm',
    mainModules: ['src/Main.elm'],
    outputFolder: '../web/static/js',
    makeParameters: ['--debug'],
    },
    babel: {
    presets: ['es2015', 'react', 'stage-0'],
    plugins: ['transform-runtime'],
    // Do not use ES6 compiler in vendor code
    ignore: [/web/static/vendor/],
    },
    sass: {
    options: {
    includePaths: ['node_modules'],
    },
    },
    },

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

    npm: {
    enabled: true,
    },
    };

  • content of elm-package.json
    {
    "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": [
    "./src",
    "./vendor"
    ],
    "exposed-modules": [],
    "dependencies": {
    "NoRedInk/elm-decode-pipeline": "3.0.0 <= v < 4.0.0",
    "elm-community/list-extra": "6.0.0 <= v < 7.0.0",
    "elm-lang/core": "5.1.1 <= v < 6.0.0",
    "elm-lang/html": "2.0.0 <= v < 3.0.0",
    "elm-lang/websocket": "1.0.2 <= v < 2.0.0"
    },
    "elm-version": "0.18.0 <= v < 0.19.0"
    }

  • file layout for your elm files relative to root of project.

  • Operating System
    OSX El Capitan

@shamanime
Copy link

I have the same issue, specially when running 'brunch build --production'.

@chazsconi
Copy link

chazsconi commented Jul 18, 2017

@bigardone @shamanime Yes, I have the same problem too. Reverting to v0.7.0 solves the issue as I believe it was introduced by #30.

Other than #33 nothing else has been changed since then apart from updates to the README.

Perhaps a solution would be to have an option to determine when the compilation is done - in the 0.7.0 way or 0.8.0 way.

For now, I will just use 0.7.0.

@jesseshieh
Copy link

I had the same problem. Downgrading to 0.7.0 fixed it for me. Thanks you!

jimmay5469 added a commit to jimmay5469/stravelixm that referenced this issue Aug 10, 2017
@nlfiedler
Copy link

It's been a while, any update on this?

@madsflensted
Copy link
Owner

If anybody can create PR where the build order is configurable then I will be happy to merge and publish.

@chazsconi
Copy link

I'm not really sure if the way that #30 changes the elm compilation to happen with the compile method to the onCompile hook is the right approach. Furthermore, I don't think having some switch to change between using compile or onCompile is appropriate as there should just be one way that works in all scenarios.

I cannot reproduce the problem that #30 tries to fix (which was related to the Brunch cache problems) - perhaps it is fixed in a different way by a later version of Brunch itself.

@stelmakh could you provide steps to reproduce the original problem in #30?

@happysalada
Copy link

had a problem where elm.js wasn't compiled at all and there was no warning.
Fell on this issue by chance and I'm super glad that reverting to 0.7 fixed it.
thanks!

@chazsconi
Copy link

chazsconi commented Oct 29, 2017

@madsflensted In the absence of any reply from @stelmakh in how to reproduce the original problem that PR #30 tried to fix, and also that, as far as I can see, #30 introduced bug #38, can we just revert #30 ?

Otherwise we will be stuck with having to use v0.7.0 forever.

@madsflensted
Copy link
Owner

madsflensted commented Oct 30, 2017 via email

@madsflensted
Copy link
Owner

Reverted PR 30, it is published as 0.10.0.
Can you check if this resolves this issue?

@happysalada
Copy link

I had a problem with elm not compiling at all, and it's fixed with version 0.10.0, thanks a lot!

@chazsconi
Copy link

Fixed for me also in 0.10.0 Thanks @madsflensted

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants