Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

node-elm-compiler receiving warn option #159

Open
DavidVII opened this issue Oct 24, 2018 · 4 comments
Open

node-elm-compiler receiving warn option #159

DavidVII opened this issue Oct 24, 2018 · 4 comments

Comments

@DavidVII
Copy link

DavidVII commented Oct 24, 2018

Anytime I save my a .elm source file, everything seems to compile just fine, but whenever I save my app.js file I get the following error:

Uncaught Error: Module build failed:
Error: Compiler process exited with error "node-elm-compiler received the `warn` option,
but that was removed in Elm 0.19.
Try re-running without passing the `warn` option."

My webpack

const path = require('path');
const glob = require('glob');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');

console.log("THE PATH: ", path.resolve(__dirname, 'elm'))

module.exports = (env, options) => ({
  optimization: {
    minimizer: [
      new UglifyJsPlugin({ cache: true, parallel: true, sourceMap: false }),
      new OptimizeCSSAssetsPlugin({})
    ]
  },
  entry: {
    './js/app.js': ['./js/app.js'].concat(glob.sync('./vendor/**/*.js'))
  },
  output: {
    filename: 'app.js',
    path: path.resolve(__dirname, '../priv/static/js')
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader'
        }
      },
      {
        test: /\.elm$/,
        exclude: ["/elm-stuff", "/node_modules"],
        loader: "elm-webpack-loader",
        options: {
          cwd: path.resolve(__dirname, 'elm'),
          debug: options.mode === 'development',
          verbose: options.mode === 'development',
          optimize: options.mode !== 'development'
        }
      },
      {
        test: /\.scss$/,
        use: [
          MiniCssExtractPlugin.loader,
          'css-loader',
          'sass-loader',
          'postcss-loader'
        ]
      }
    ],
    noParse: [/.elm$/]
  },
  plugins: [
    new MiniCssExtractPlugin({ filename: '../css/app.css' }),
    new CopyWebpackPlugin([{ from: 'static/', to: '../' }])
  ]
});

and my app.js file

import { Elm } from "../elm/src/Onboarding.elm"

const elmElement = document.getElementById("elm-onboard")

if (elmElement) {
  Elm.Onboarding.init({ node: elmElement })
}

Any idea what's going on here?

@simonh1000
Copy link
Contributor

verbose: options.mode === 'development', might be the problem

@DavidVII
Copy link
Author

@simonh1000 this did not have an effect.

I recently noticed that I've also been getting another error

Uncaught Error: Module build failed: Error: Compiler process exited with error Compilation failed
-- NO elm.json FILE ------------------------------------------------------------

It looks like you are starting a new Elm project. Very exciting! Try running:

    elm init

It will help you get set up. It is really simple!

I feel that the elm source isn't being compiled after saving my main JS entry point. Whenever I change and save my elm source, it all compiles fine and works as expected.

@nikolis
Copy link

nikolis commented Jan 10, 2019

@DavidVII Any luck tracking down your problem ? It looks I have the exact same problem.

@DavidVII
Copy link
Author

@nikolis this is going to sound odd, but try restarting your computer. Something somewhere got jacked up along the way (though my app was a super basic set up at the time).

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

No branches or pull requests

3 participants